How to get the typed text?

2 posts, 0 answers
  1. Alfa
    Alfa avatar
    34 posts
    Member since:
    May 2005

    Posted 10 Mar 2010 Link to this post

    Hi,

    In my application, i have requirement where
    when user types in text in combobox and moves out(lost of focus), if the text is not in ItemList, this text must be added in ItemList.

    I have used 
    void Control_LostFocus(object sender, RoutedEventArgs e)
    {
    if (!Duplicate(this.Text))
    {
    Control.Items.Insert(0, (new RadComboBoxItem() { Content = This.Text}));
    }
    }

    It works fine in most of the situation but in the case where, say "AAA" is already in ItemList, I type "A" and move out...
    'A' doesn't get inserted because, this.Text returns "AAA" not "A".

    So, my question is can i get the typed text from ComboBox.?

    I tried 
    TextBox textBox = this.ChildrenOfType<TextBox>()[0];
    string text = textBox.SelectedText; //textBox.Text //non of them gave Typed text.

    But strangely when I use this code, the ComboBox stops opening\displaying items.

    Rdgs
    Afla 

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 10 Mar 2010 Link to this post

    Hi Alfa,

    Please, download the latest internal build of RadControls for Silverlight, where the behavior of the Text property should be much more consistent, e.g. the property will always contain the string that is visible in the TextBox:
    http://www.telerik.com/account/downloads/internal-builds.aspx

    Regards,
    Valeri Hristov
    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