ReadOnly for ComboBox?

10 posts, 0 answers
  1. Joshua Ruppert
    Joshua Ruppert avatar
    5 posts
    Member since:
    Feb 2006

    Posted 14 Jan 2008 Link to this post

    Is there anything I can do to have a ComboBox behave has a read only element, like you can with a TextBox?

    I want to have a field that displays data, but is not always editable, and isn't the hard to read gray-on-gray of the disabled state. I generally suppress the dropdown and then use a light gray back ground with black text, but I don't see anyway to suppress the dropdown.

    Is there a way to achieve what I'm looking for?

    Josh
  2. Georgi
    Admin
    Georgi avatar
    212 posts

    Posted 16 Jan 2008 Link to this post

    Hi Joshua Ruppert,

    Thank you for writing.

    As far as I understand, you would like a different appearance from the default RadComboBox when the control is disabled (the Enabled property is set to false). Since in this state an image is drawn onto the control itself, you cannot change it.

    However, thanks to the element hierarchy of our controls and the theming mechanism, you can change this behavior. You should implement your custom theme with added states to the necessary elements with condition when RadElement.Enabled property is set to false. Then all you have to do is to apply the theme and set the UseDefaultDisabledPaint property to false as shown below:

        RadComboBox.ComboBoxElement.UseDefaultDisabledPaint = false;

    If you need any further assistance, please write us again.

    Sincerely yours,

    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Joshua Ruppert
    Joshua Ruppert avatar
    5 posts
    Member since:
    Feb 2006

    Posted 17 Jan 2008 Link to this post

    Thanks, I'll try that.

    Josh
  5. Michael
    Michael avatar
    22 posts
    Member since:
    Jun 2012

    Posted 20 Jan 2008 Link to this post

    Another solution is to set the property, DropDownStyle to DropDownList. This allows the control to maintain it's color and behave in a readonly manner.

    You can change this property in the Properties window from the Design View of your Form.

    I hope this helps.

    Michael
  6. Joshua Ruppert
    Joshua Ruppert avatar
    5 posts
    Member since:
    Feb 2006

    Posted 21 Jan 2008 Link to this post

    I've done this, but it's not quite what I'm looking for. A read-only drop down for me would suppress the display of the dropdown list, as well as preventing of typing into the field.
  7. Kiril
    Admin
    Kiril avatar
    158 posts

    Posted 22 Jan 2008 Link to this post

    Hello Joshua Ruppert,

    I just wanted to make sure that you have achieved the control behavior you were looking for using the solution we provided in our last post.

    Please let us know if we can help you any further.

    Regards,
    Kiril
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Feizal Amlani
    Feizal Amlani avatar
    91 posts
    Member since:
    Feb 2007

    Posted 28 Sep 2010 Link to this post

    Hello,

    I am trying to implement the same behaviour.  Is it possible to manipulate the combobox to a readonly control.  For example, the view only mode would show 'Canada'.  When the user selects the update link on the page the text (Canada) will change to a combobox where the user can update the country.

    I don't want to put two controls on the page but manipulate the combobox in displaying the full behaviour to just displaying the selected text in different modes.

    Thanks,
    Feizal
  9. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 30 Sep 2010 Link to this post

    Hi Feizal Amlani,

    In this case the solution is to set the property, DropDownStyle to DropDownList. This will prevent you from typing in the control's TextBox part. In addition, you should subscribe and cancel the event DropDownOpening:

    void radDropDownList1_PopupOpening(object sender, CancelEventArgs e)
    {
       if( this.radDropDownList1.DropDownStyle==DropDownList)
       {
         e.Cancel = true;
       }
    }

    I hope this helps.

     

    Best wishes,
    Peter
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  10. Feizal Amlani
    Feizal Amlani avatar
    91 posts
    Member since:
    Feb 2007

    Posted 30 Sep 2010 Link to this post

    Thanks for your reply.  However, I am using a RadComboBox and not a RadDropDownList and there is no DropDownStyle property for the combobox.

    Is there a way to implement the behaviour using the combobox?

    Thanks,
    Feizal
  11. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Oct 2010 Link to this post

    Hello Feizal,

    Thanks for writing back.

    I am not sure why you can't find the DropDownStyle property at RadComboBox. The following code snippet should work on your side:

    RadComboBox radComboBox1 = new RadComboBox();
    radComboBox1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;

    Please refer to this article for additional information.

    Generally, I would recommend updating to RadDropDownList. RadComboBox is an obsolete control and it will be removed in one of our next version. Please find additional information about RadDropdownList here.

    I hope this will help.

    Sincerely yours,
    Peter
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready