We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Change the GroupCaptionText based on Display member of the GridComboboxColumn?

In the SfDataGrid, while grouping the GridComboBoxColumn, the Group key is displayed in the GroupCaptionText based on the SelectedValuePath instead of the DisplayMemberPath of the GridComboBoxColumn. In the following code example, the GridComboBoxColumn is defined with the DisplayMemberPath and SelectedValuePath.



The following is the ViewModel class with ItemsSource for the GridComboBoxColumn



In the following screenshot of the SfDataGrid, the Group key displays the actual value instead of the Display value of the column.



It is possible to display the Group key based on the DisplayMemberPath in the GroupCaptionText by setting the GroupColumnDescription.Converter property that converts the actual value based on the DisplayMemberPath. GridComboBoxColumn is passed as the Converter parameter and the underlying record bound with the row is passed as the value for the converter. Refer to the following code example for customizing the GroupColumnDescription with the Converter defined.



The following is the Converter that returns the GroupKey based on the DisplayMemberPath by using the value (Record) and the parameter (Column) passed.



The following screenshot shows the Group Key that is changed based on the DisplayMemberPath.

But, when you group at run time by dragging and dropping the column into the GroupDropArea, you can set the Converter by handling the SfDataGrid.View.GroupDescriptions.CollectionChanged as in the following code example.



C# converter class

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
3446 01/27/2015 01/25/2016 WPF SfDataGrid 4.5
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon