I obtained window and the spinner object:
var OrderWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "*NAME*"));
var numberOfXX = OrderWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "*NAME*"));
then I am accessing spinner RangeValuePatterm:
RangeValuePattern value = numberOfXX.GetCurrentPattern(RangeValuePattern.Pattern) as RangeValuePattern;
And i should be able to use simple:
value.SetValue(5);
To modify its value, but it is not working. I am getting an exception of type 'System.ArgumentOutOfRangeException' - Value is greater than Maximum. (What is true, but I don't know how to change maximum allowed value...).
Also I have no idea how to get its current value, since simple:
value.Current.Value
always return 0, regardless what value is entered. I can simply send keys to set value of a spinner instead accessing it via UIAutomation, but I don't know hot to read out the actual value of the spinner → thus can't check it if it is correct.