Jan 16, 2009 at 5:32 PM
Edited Jan 19, 2009 at 6:44 PM
I seemed to have solved my query with the following two lines of code.
I am looking for an alternative to using Core.InputDevices.Keyboard.Instance.Enter("<a year number>"),
because i need to update a TextBox is in a ComboBox that doesnt remain expanded when double clicking on it via White.
What to do?
The above is a short rendition of my problem,
if more detail is needed, here is a longer rendition of the problem:
I'm using an open source DatePicker. The one i am using can be seen
The DatePicker has a none-editable text field (showing whatever selected date) and button to expand it.
It is essentially a combo box. When you click the button or the none-editable text field in the Combo, it then
expands with a grid control containing dates, - and - beside it an editable TextBox with the year.
When running White via an NUNIT test, to test a wpf standalone,
I DoubleClick the combo box as in the 3 lines of code below.
It expands but immediately then closes.
Core.UIItems.Finders.SearchCriteria scForDTCombo = Core.UIItems.Finders.SearchCriteria.ByAutomationId("comboForDateTimePicker");
Core.UIItems.ListBoxItems.WPFComboBox dtCombo = wpfWindow.Get<Core.UIItems.ListBoxItems.WPFComboBox>(scForDTCombo);
I (nevertheless) then try to get the TextBox that is in the expanded Combo and write a new year in it.
I succeed actually in getting the TextBox that is contained in the ComboBox, but it doesnt work because the combo isnt expanded any longer.
(a) How would i keep the combo expanded?
(b) Is there another way to get the year into the TextBox?
For example without using the Core.InputDevices.Keyboard
and thus being dependant on the fact that the TextBox has keyboard focus.
Here's the code i using currently to acces the TextBox.
Core.UIItems.Finders.SearchCriteria scPartYear = Core.UIItems.Finders.SearchCriteria.ByAutomationId("PART_Year");
Core.UIItems.IUIItem iuItemForpartYearTB = wpfWindow.Get(scPartYear);
Core.UIItems.TextBox partYearTB = (Core.UIItems.TextBox)iuItemForpartYearTB;
I seemed to have solved my problem with the following two lines of code: