I am using FlaUI
to automate my WPF
app. I have a datagrid
control from DevExpress
. I want to access any individual row and all the columns of that row and edit it using FlaUI
. The DevExpress forum has the following sample available but this is for UIA library.How can I rewrite this using FlaUI
libraries?
AutomationElement gridElem = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.LocalizedControlTypeProperty, "datagrid"));
GridPattern gridPattern = (GridPattern)gridElem.GetCurrentPattern(GridPattern.Pattern);
int rowCount = gridPattern.Current.RowCount;
List<object> values = new List<object>();
for (int i = 0; i < rowCount; i++) {
AutomationElement item = gridPattern.GetItem(i, 0);
ValuePattern valuePattern = (ValuePattern)item.GetCurrentPattern(ValuePattern.Pattern);
values.Add(valuePattern.Current.Value);
Very new to FlaUI
& automation
.
Finally with some help from
DevExpress
Support, I was able to achieve my intentions. Here is the piece of code that works well :)before this, finding element using
FlaUI is necessary
Grid(reference from
FlaUI.Core.AutomationElements
)private Grid grid=>windows.FindFirstDescendant(cf=>cf.ByAutomationID("dataGrid").AsGrid();