Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get ComboBox.SelectedText in WPF

Tags:

wpf

In WPF ComboBox does not have SelectedText property.

Is there a way to achieve the same functionality as TextBox SelectedText has in WPF

like image 289
02Anant Avatar asked Jul 02 '10 21:07

02Anant


1 Answers

You can get access to the ComboBox's TextBox by using:

var edit = (TextBox)myCombo.Template.FindName("PART_EditableTextBox", myCombo);

Then you can access the SelectedText property of that TextBox:

var selectedText = edit.SelectedText;
like image 177
codekaizen Avatar answered Sep 19 '22 01:09

codekaizen