Get Selected/Highlighted Text from WPF ComboBox

Niladri.Biswas
Posted by Niladri.Biswas under WPF category on | Points: 40 | Views : 1362
private void button1_Click(object sender, RoutedEventArgs e)
{
string result = string.Empty;
var editableTextBox = comboBox1.Template.FindName("PART_EditableTextBox", comboBox1) as TextBox;
if (editableTextBox != null)
{
result = editableTextBox.SelectedText;
}

MessageBox.Show(string.Format("Selected Text is {0}",result));

}

Comments or Responses

Login to post response