This is a migrated thread and some comments may be shown as answers.

Sort GridViewComboBoxColumn with multiple columns

1 Answer 149 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eva
Top achievements
Rank 1
Eva asked on 29 Jun 2015, 05:55 PM

I have a RadGridView with a GridViewComboBoxColumn. The GridViewComboBoxColumn displays two columns when it drops down. I would like to show headers for each column inside the ComboBox so that the user can sort the lists by either column.

However, I am unable to display the headers.

Here is my code:

 

<telerik:RadGridView Grid.Row="1" Name="mainGridView">
<telerik:RadGridView.Columns>
<telerik:GridViewComboBoxColumn UniqueName="NominalAccount" Header="Nominal Account" Width="*" DataMemberBinding="{Binding RefCode}"   ItemsSource ="{Binding NominalAccountsItemList, Mode=TwoWay}"  DisplayMemberPath="DisplayName"  SelectedValueMemberPath="RefCode" >
 <telerik:GridViewComboBoxColumn.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions >
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding RefCode}" Padding="0,0,6,0"></TextBlock>
                                <TextBlock Text="{Binding NominalAccountName}"  Grid.Column="1"></TextBlock>
                            </Grid>
                        </DataTemplate>
                    </telerik:GridViewComboBoxColumn.ItemTemplate>
                </telerik:GridViewComboBoxColumn>
     </telerik:RadGridView.Columns>
        </telerik:RadGridView>

 

Any help on how to get headers for my columns in the dropdown would be much appreciated!

Thanks in advance

 

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Jul 2015, 08:59 AM
Hello,

GridViewComboBoxColumn itself do not suggest such an in-built option, however, you can customize the column's editor (RadComboBox) or set a specific ItemTemplate (as you already do).
As to configuring it property, you can refer to the "Drop down with headers" github example.
Although GitHub is a very well-known platform we saw a better and easier approach for reviewing our examples developing our brand new SDK Samples Browser. You can install it and then use it to review the examples.

Regards,
Dimitrina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
GridView
Asked by
Eva
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or