C1FlexGridGroupHeaderConverter プロパティ |
名前空間: C1.WPF.FlexGrid
グリッドがデフォルトで作成するグループヘッダーには、グループ化の基準になるプロパティの名前、そのプロパティの値、およびグループ内の項目数が表示されます。
独自のグループヘッダーコンバータクラスを定義し、そのクラスのインスタンスをグリッドの GroupHeaderConverter プロパティに割り当てることで、この情報を変更またはカスタマイズできます。
class GroupHeaderConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var gr = parameter as GroupRow; var group = gr.Group; if (group != null && gr != null && targetType == typeof(string)) { var desc = gr.Grid.CollectionView.GroupDescriptions[gr.Level] as PropertyGroupDescription; return desc != null ? string.Format("{0}: {1} ({2:n0} item{3})", desc.PropertyName, group.Name, group.ItemCount, group.ItemCount == 1 ? string.Empty : "s") : string.Format("{0} ({1:n0} items)", group.Name, group.ItemCount); } // デフォルト return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return value; } }