This is a migrated thread and some comments may be shown as answers.

Selected Text in AutocompleteBox

4 Answers 158 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Abhi
Top achievements
Rank 1
Abhi asked on 12 Mar 2013, 11:42 AM
How to Get the SelectedText in AutoCompleteBox in LostFocus Event.......pls give any solution for this

Thanks,
Abhi

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Mar 2013, 10:07 AM
Hi Abhi,

Please have a look into the following C# code.

C#:
private void radAutoCompleteBox1_LostFocus(object sender, RoutedEventArgs e)
{
    string selectedItemText = radAutoCompleteBox1.SelectedItem.ToString();
}

Thanks,
Princy.
0
Abhi
Top achievements
Rank 1
answered on 15 Mar 2013, 12:33 PM
Thanks for reply

My exact problem is:
For Example : If we have 3 colors in ColorList
1.Red
2.Green and
3.blue  (ItemSource to AutocompleteBox is ColorList)

after selecting the Item from the List  (for example => I'll select Green)

Now, If I select part of the Text "ree" from "Green"

How to get this "ree" in Lost_Focus Event of AutoCompleteBox (selectedTex in the selectedItem)

pls give any solution for this............
0
Ivo
Telerik team
answered on 15 Mar 2013, 01:25 PM
Hi,

In order to get the selected text in the textbox portion of the control you will have to get the TextBox element and use directly its SelectedText property.

var autoComplete = (RadAutoCompleteBox)sender;
var textBox = autoComplete.ChildrenOfType<TextBox>().First();
string selectedText = textBox.SelectedText;
Greetings,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Abhi
Top achievements
Rank 1
answered on 19 Mar 2013, 06:23 AM
HI Ivo,

             Thanks I got it..........

Tags
AutoCompleteBox
Asked by
Abhi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Abhi
Top achievements
Rank 1
Ivo
Telerik team
Share this question
or