Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Prevent user from using the backspace key to leave value blank

Not answered Prevent user from using the backspace key to leave value blank

Feed from this thread
  • Kevin Kalitowski avatar

    Posted on Dec 29, 2011 (permalink)

    I am using a ComboBox with the following settings:
    <Setter Property="TextSearchMode" Value="StartsWith" />
    <Setter Property="IsEditable" Value="True" />
    <Setter Property="IsReadOnly" Value="True" />

    Is there a codeless (MVVM) way to force a valid value to be chosen?  As it stands, the user can click into the "TextBox" part of the RadComboBox, hit the backspace key repeatedly to clear out the text, and effectively set the value to null.  This is even though the ComboBox does not have a null / blank value available for selection via the mouse / arrow keys.

    The ideal situation would be to return the ComboBox to its original value if the user does not select a valid value.

    I'm sure there is a method of doing this via code behind, but this seems like something that could already be built into the control.

    Thank you,
    Kevin

    Reply

  • Yana Yana admin's avatar

    Posted on Dec 30, 2011 (permalink)

    Hello Kevin,

    RadComboBox doesn't have any built-in validation. I've attached a simple example which demonstrates how you can implement validation using IDataErrorInfo interface. Please download the attachment and give it a try.

    Hope this helps.

    Kind regards,
    Yana
    the Telerik team

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

    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > ComboBox > Prevent user from using the backspace key to leave value blank
Related resources for "Prevent user from using the backspace key to leave value blank"

WPF ComboBox Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]