UIAutomation AutomationElement.FindAll condition
引数, PropertyCondition
に指定できる Property 要素について
PropertyCondition
のコンストラクタは下記の通り.
public PropertyCondition (System.Windows.Automation.AutomationProperty property, object value);
このコンストラクタの引数 property
に指定できる要素を下記に列挙する.
System.Windows.Automation.AutomationElement
フィールド名 |
AcceleratorKeyProperty |
AccessKeyProperty |
AutomationIdProperty |
BoundingRectangleProperty |
ClassNameProperty |
ClickablePointProperty |
ControlTypeProperty |
CultureProperty |
FrameworkIdProperty |
HasKeyboardFocusProperty |
HelpTextProperty |
IsContentElementProperty |
IsControlElementProperty |
IsDockPatternAvailableProperty |
IsEnabledProperty |
IsExpandCollapsePatternAvailableProperty |
IsGridItemPatternAvailableProperty |
IsGridPatternAvailableProperty |
IsInvokePatternAvailableProperty |
IsItemContainerPatternAvailableProperty |
IsKeyboardFocusableProperty |
IsMultipleViewPatternAvailableProperty |
IsOffscreenProperty |
IsPasswordProperty |
IsRangeValuePatternAvailableProperty |
IsRequiredForFormProperty |
IsScrollItemPatternAvailableProperty |
IsScrollPatternAvailableProperty |
IsSelectionItemPatternAvailableProperty |
IsSelectionPatternAvailableProperty |
IsSynchronizedInputPatternAvailableProperty |
IsTableItemPatternAvailableProperty |
IsTablePatternAvailableProperty |
IsTextPatternAvailableProperty |
IsTogglePatternAvailableProperty |
IsTransformPatternAvailableProperty |
IsValuePatternAvailableProperty |
IsVirtualizedItemPatternAvailableProperty |
IsWindowPatternAvailableProperty |
ItemStatusProperty |
ItemTypeProperty |
LabeledByProperty |
LocalizedControlTypeProperty |
NameProperty |
NativeWindowHandleProperty |
OrientationProperty |
PositionInSetProperty |
ProcessIdProperty |
RuntimeIdProperty |
SizeOfSetProperty |
System.Windows.Automation.DockPattern
フィールド名 |
DockPositionProperty |
System.Windows.Automation.ExpandCollapsePattern
フィールド名 |
ExpandCollapseStateProperty |
System.Windows.Automation.GridItemPattern
フィールド名 |
ColumnProperty |
ColumnSpanProperty |
ContainingGridProperty |
RowProperty |
RowSpanProperty |
System.Windows.Automation.GridPattern
フィールド名 |
ColumnCountProperty |
RowCountProperty |
System.Windows.Automation.MultipleViewPattern
フィールド名 |
CurrentViewProperty |
SupportedViewsProperty |
System.Windows.Automation.RangeValuePattern
フィールド名 |
IsReadOnlyProperty |
LargeChangeProperty |
MaximumProperty |
MinimumProperty |
SmallChangeProperty |
ValueProperty |
System.Windows.Automation.ScrollPattern
フィールド名 |
HorizontallyScrollableProperty |
HorizontalScrollPercentProperty |
HorizontalViewSizeProperty |
VerticallyScrollableProperty |
VerticalScrollPercentProperty |
VerticalViewSizeProperty |
System.Windows.Automation.SelectionPattern
フィールド名 |
CanSelectMultipleProperty |
IsSelectionRequiredProperty |
SelectionProperty |
System.Windows.Automation.SelectionItemPattern
フィールド名 |
IsSelectedProperty |
SelectionContainerProperty |
System.Windows.Automation.TableItemPattern
フィールド名 |
ColumnHeaderItemsProperty |
RowHeaderItemsProperty |
System.Windows.Automation.TablePattern
フィールド名 |
ColumnHeadersProperty |
RowHeadersProperty |
RowOrColumnMajorProperty |
System.Windows.Automation.TransformPattern
フィールド名 |
CanMoveProperty |
CanResizeProperty |
CanRotateProperty |
System.Windows.Automation.TogglePattern
フィールド名 |
ToggleStateProperty |
System.Windows.Automation.ValuePattern
フィールド名 |
IsReadOnlyProperty |
ValueProperty |
System.Windows.Automation.WindowPattern
フィールド名 |
CanMaximizeProperty |
CanMinimizeProperty |
IsModalProperty |
IsTopmostProperty |
WindowInteractionStateProperty |
WindowVisualStateProperty |
確認用実装コード
上記のタイプに対応したフィールドを列挙させるための確認用コードを下記に示す.
namespace UIA;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Automation;
public sealed class UIAAutomationTypeProperty
{
/// <summary></summary>
public Type Type => _type;
/// <summary></summary>
public string FieldName => _fieldName;
/// <summary></summary>
public AutomationProperty Property => _property;
private readonly Type _type;
private readonly string _fieldName;
private readonly AutomationProperty _property;
private UIAAutomationTypeProperty(
Type type,
string fieldName,
AutomationProperty property)
{
_type = type;
_fieldName = fieldName;
_property = property;
}
public static IEnumerable<UIAAutomationTypeProperty> Items => _items;
private static IEnumerable<UIAAutomationTypeProperty> _items;
static UIAAutomationTypeProperty()
{
_items = typeof(AutomationElement)
.Assembly
.GetTypes()
.SelectMany(t => t.GetFields(BindingFlags.Public | BindingFlags.Static)
.Where(f => f.FieldType == typeof(AutomationProperty)/*.IsSubclassOf(typeof(AutomationProperty))*/)
.Select(f => new UIAAutomationTypeProperty(t, f.Name, f.GetValue(null) as AutomationProperty ?? throw new NullReferenceException())))
.ToArray();
}
}