How to set properties to a combo box that is inside a Grid

2 posts, 0 answers
  1. Parameswari
    Parameswari avatar
    19 posts
    Member since:
    Jun 2011

    Posted 25 Nov 2011 Link to this post

      In my design ,I have a grid ,one of the column of the grid is combobox control.
     In the combo box- drop down, I have binded Customer ID and CustomerName using EditorStyle.
     The issue is the drop down list the Items in ascending order of the CustomerID ,But I need to display the items in Descending order of CustomerName .Is there any property to achieve it?  Kindly help us to solve the problem.
    Below is the Code snippet:

    <TelerikGrid:GridViewComboBoxColumn x:Name="CmbItm" Width="2*" IsComboBoxEditable="True" IsFilterable="True"
             DataMemberBinding="{Binding CustomerID}" UniqueName="Customer_Vendor"
             DisplayMemberPath="CustomerName" Header="Customer/Vendor"
              ItemsSource="{Binding Path=Customer,    Source={StaticResource journalentryViewModel}}">
                                <Style TargetType="TelerikGrid:GridViewCell">
                                            <Setter Property="Height" Value="19"/>
                                    <TelerikGrid:GridViewComboBoxColumn.EditorStyle >
                                        <Style TargetType="TelerikCombo:RadComboBox" >
                                            <Setter Property="MinHeight" Value="15"/>
                                            <Setter Property="Height" Value="19"/>                                          
                                            <Setter Property="Margin" Value="0"/>
                                            <Setter Property="ItemContainerStyle">
                                                    <Style TargetType="TelerikCombo:RadComboBoxItem">
                                                        <Setter Property="Template">
                                                                        <Grid.RowDefinitions >
                                                                            <ColumnDefinition />
                                                                            <ColumnDefinition />
                                                                            <ColumnDefinition />
                                                                        <TextBlock Text="{Binding CustomerName}" Grid.Row="0" Grid.Column="0"  Width="256" />
                                                                        <TextBlock Text="{Binding CustomerID}" Grid.Row="0" Grid.Column="1" Width="0" />
  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 25 Nov 2011 Link to this post

    Hello Parameswari,

    RadComboBox cannot sort its items, but if you sort its items source the control will display the items in the correct order.

    All the best,
    Valeri Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top