Reputation: 2984
I am attempting to use the following code to scroll a scrollbar in a third party .net application. When I run the code in visual studio, it throws an access violation. When I execute the assembly outside visual studio, it says Unsupported Pattern.... Any ideas are greatly appreciated =]
if(child.Current.ClassName == "ScrollBar")
{
PropertyCondition condition = new PropertyCondition(AutomationElement.AutomationIdProperty, child.Current.AutomationId);
AutomationElement btnElement = child.FindFirst(TreeScope.Element, condition);
ScrollPattern btnPattern = btnElement.GetCurrentPattern(ScrollPattern.Pattern) as ScrollPattern;
btnPattern.ScrollVertical(ScrollAmount.LargeIncrement);
}
Upvotes: 1
Views: 484
Reputation: 1066
Few checks that i would have done:
Upvotes: 2