This project is read-only.

How to set Selected Value for combox box?

Jun 16, 2010 at 6:14 AM



I have a combo box named cbSex with 3 values: Unknown, Male, Female? How to set value Male for cbSex? Please help


Jun 18, 2010 at 5:51 AM


I use the below code to set Selected Value = "Male" for Combo box comboBoxSex

ComboBox comboBoxSex = mainWindow.Get<ComboBox>("comboBoxSex");
White.Core.InputDevices.AttachedKeyboard keyboard = mainWindow.Keyboard;


This code works with the combo box having data bind in xaml file(our developer hard-code)

However, with the combo box having the data binding in code-behind(cs)file this code does not work. I could not set selected Value correctly or get SelectedItemText after setting the SelectedValue for that combo. It always returns the selectedItemText=string.empty

Please consult me on this