GridViewComboBox vs Combobox IsReadOnly

4 posts, 1 answers
  1. Michael
    Michael avatar
    7 posts
    Member since:
    Mar 2013

    Posted 10 Apr 2015 Link to this post

    I'd like to duplicate the functionality of the Combobox in the grid. If IsComboBoxEditable is set to True and is IsReadOnly is set to True, it disable selecting anything in the column. What i really want is the ComboBox behavior IsEditable="True" IsReadOnly="True" allows you to type but only will select value rows.

    How do I accomplish this? 

  2. Michael
    Michael avatar
    7 posts
    Member since:
    Mar 2013

    Posted 10 Apr 2015 in reply to Michael Link to this post

    *only select "valid" rows. If the value isn't in the list, you can't type those letters. Just like the ComboBox Edit Mode demo.
  3. Answer
    Stefan
    Admin
    Stefan avatar
    1073 posts

    Posted 13 Apr 2015 Link to this post

    Hello Michael,

    A way of achieving this is by following these steps:

    1.   Define a style as a static resource which targets RadComboBox:
    <Style x:Key="comboStyle"
           TargetType="telerik:RadComboBox">
        <Setter Property="IsEditable"
                Value="True"/>
        <Setter Property="IsReadOnly"
                Value="True"/>
    </Style>

    2.   Apply the style to the editor of GridViewComboBoxColumn through the EditorStyle property:
    <telerik:GridViewComboBoxColumn DataMemberBinding="{Binding Name}"
                                    IsComboBoxEditable="True"
                                    ItemsSource="{Binding Players}"
                                    EditorStyle="{StaticResource comboStyle}"/>


    Please, give the approach a try and let me know how it works for you.

    Best Regards,
    Stefan
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  4. Michael
    Michael avatar
    7 posts
    Member since:
    Mar 2013

    Posted 13 Apr 2015 in reply to Stefan Link to this post

    Perfect. Thanks.
Back to Top