Issues around read only combo box

2 posts, 0 answers
  1. Adam
    Adam avatar
    70 posts
    Member since:
    Jun 2008

    Posted 17 May 2013 Link to this post

    Hey guys,

    I'm seeing a couple of issues I need to work through around setting up our combo boxes.  Here are our requirements:

    1. We're using the RadComboBox as IsEditable though it will not accept custom text.  This is more for aesthetics.  When we set the IsReadOnly="True", I believe we see that the textbox portion of dropdown is appropriately readonly.  However, the dropdown button is still enabled and you can still open the items.  I suppose I can see how this would be desirable for some people, but is there a different way to signal that the control itself should be readonly, not just the editable textbox?
    2. We need to set IsReadOnly and not IsEnabled because it still allows us to select and copy the text of the selected item.  However, it also necessary that we do not focus or otherwise allow the user to tab into readonly fields since that wastes their time.  With this, we see that for some reason a control needs focus in order for text to be selectable.  This is most apparent with the silverlight textbox.  Which brings me to an overall issue that I think I'm seeing with the combo box...
    3. At least with the settings we use in the combo box, IsTabStop="False" does not seem to work to stop the tab from giving the control focus.  Is this a known bug?

    I suppose a workaround for some of this tabbing behavior is that I COULD allow focus to be had on readonly fields but manually handle the tab behavior to continue to skip over readonly fields.

  2. Vladi
    Vladi avatar
    749 posts

    Posted 21 May 2013 Link to this post

    Hi Adam,

    Straight to your questions:
    • Considering that setting the IsEnabled property of the control is not usable in the behavior you are trying to implement you could do the following:
    1. Using Implicit Styles customize the RadComboBoxStyle and its EditableTemplate.
    2. In that Template locate the PART_DropDownButton RadToggleButton and bind its IsEnabled property to the PART_EditableTextBox TextBox's IsReadOnly.
    3. Create a converter that will reverse the boolean value of the two properties to achieve the desired behavior.
    • We researched the IsTabStop issue and it is a know issue in the standard ComboBox control. The issue is that when the ComboBox is in editable mode and the IsTabStop property is set from the xaml it is not working as expected. In order to overcome this limitation you will need to do the following:
    1. Create a custom RadComboBox by creating a class that inherits RadComboBox and override its OnApplyTemplate method.
    2. Use that method to save the PART_EditableTextBox TextBox to a custom public property.
    3. When changing the IsReadOnly property rather then changing the IsTabStop of the hole RadComboBox control set it to that saved TextBox.

    We created and attached a sample project for you of the previously described approach, hope this is helpful.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top