EzList
EzList is created using an existing element who has a ControlType of List. This class opens up list specific functionality
💡 Note
If the underlying element being used to construct EzList does not have a ControlType of List, an exception will be thrown on construction
Syntax
public class EzList : EzElement
Constructors
Name | Input | Description |
---|---|---|
EzList(EzElement element) | EzElement | Creates a new instance of EzList based on an existing EzElement |
EzList(EzRoot root) | EzRoot | Creates a new instance of EzList based on an existing EzRoot |
EzList(AutomationElement element) | AutomationElement | Creates a new instance of EzList based on an existing AutomationElement |
Properties
Name | Type | Description |
---|---|---|
ScrollPattern | ScrollPattern | Houses the underlying windows ScrollPattern. Will return null if ExposeBackingWindowsPatterns is not set to true |
SelectionPattern | SelectionPattern | Houses the underlying windows SelectionPattern. Will return null if ExposeBackingWindowsPatterns is not set to true |
VerticalScrollPct | double | Houses the amount the current list is scrolled in the vertical direction as a percent. 0% is all the way scrolled up and 100% is all the way scrolled down |
HorizontalScrollPct | double | Houses the amount the current list is scrolled in the horizontal direction as a percent. 0% is all the way scrolled to the left and 100% is all the way scrolled to the right |
VerticalViewSize | double | I have no fucking clue |
HorizontalViewSize | double | I have no fucking clue |
CanSelectMultiple | bool | Houses whether or not the list can select multiple items at once |
SelectedItems | IEnumerable<EzElement> | Gets all currently selected items in the list |
Methods
Name | Return Type | Description |
---|---|---|
ScrollVertical(ScrollAmount amount) | void | Scrolls the list vertically based on the ScrollAmount passed in |
ScrollHorizontal(ScrollAmount amount) | void | Scrolls the list horizontally based on the ScrollAmount passed in |
ScrollHorizontalAndVertical(ScrollAmount horizontalAmount, ScrollAmount verticalAmount) | void | Scrolls the list horizontally and vertically based on both the horizontal/vertical ScrollAmount values passed in |
SetHorizontalScrollPct(double percent) | void | Sets the horizontal scroll percentage based on the percentage value passed in |
SetVerticalScrollPct(double percent) | void | Sets the vertical scroll percentage based on the percentage value passed in |
SetVerticalAndHorizontalScrollPct(double horizontalPercent, double verticalPercent) | void | Sets the vertical and horizontal scroll percentages based on the percentage values apssed in |
Samples and Usage
The EzList element is usually constructed with an instance of EzElement and effectively sits on top of EzElement. It provides some list specific functionality.
Sample:
//Simple method to launch Windows' built in calculator application const string calculatorPath = C:\\Windows\\System32\\calc.exe"; //Get an instance of EzProcess in order to create EzRoot. Wrap it in a using statement to ensure that //.Dispose() is called using (EzProcess process = new EzProcess(calculatorPath, "Calculator")) { process.StartProcess(); //Get the root element of the application EzRoot root = new EzRoot(process); //Use the .FindChildByAutomationId to query all children of the root for the first element whose //AutomationId property is equal to "TestGridName" EzElement element = root.RootElement.FindChildByAutomationId("TestGridName"); //Create a new EzGrid instance with our EzElement instance. Note that if the control type of our //EzElement intance is not List, an exception will be thrown EzList list = new EzList(element); //Set the scroll percentage to 50% list.SetHorizontalScrollPct(50); }