internal override object?GetPropertyValue(UiaCore.UIA propertyID) { switch (propertyID) { case UiaCore.UIA.LiveSettingPropertyId: return(Owner is IAutomationLiveRegion owner ? owner.LiveSetting : base.GetPropertyValue(propertyID)); case UiaCore.UIA.ControlTypePropertyId: // "ControlType" value depends on owner's AccessibleRole value. // See: docs/accessibility/accessible-role-controltype.md return(AccessibleRoleControlTypeMap.GetControlType(Role)); case UiaCore.UIA.NativeWindowHandlePropertyId: return(Owner.InternalHandle); case UiaCore.UIA.IsEnabledPropertyId: return(Owner.Enabled); } if (Owner.SupportsUiaProviders) { switch (propertyID) { case UiaCore.UIA.IsKeyboardFocusablePropertyId: return(Owner.CanSelect); } } return(base.GetPropertyValue(propertyID)); }
internal override object?GetPropertyValue(UiaCore.UIA propertyID) { switch (propertyID) { case UiaCore.UIA.LiveSettingPropertyId: return(Owner is IAutomationLiveRegion owner ? owner.LiveSetting : base.GetPropertyValue(propertyID)); case UiaCore.UIA.ControlTypePropertyId: // "ControlType" value depends on owner's AccessibleRole value. // See: docs/accessibility/accessible-role-controltype.md return(AccessibleRoleControlTypeMap.GetControlType(Role)); } if (Owner.SupportsUiaProviders) { switch (propertyID) { case UiaCore.UIA.IsKeyboardFocusablePropertyId: return(Owner.CanSelect); case UiaCore.UIA.IsOffscreenPropertyId: case UiaCore.UIA.IsPasswordPropertyId: return(false); case UiaCore.UIA.AccessKeyPropertyId: return(string.Empty); case UiaCore.UIA.HelpTextPropertyId: return(Help ?? string.Empty); } } return(base.GetPropertyValue(propertyID)); }
public void ToolStripGripAccessibleObject_GetPropertyValue_ControlType_IsExpected_ForCustomRole(AccessibleRole role) { using ToolStripGrip toolStripGrip = new ToolStripGrip(); toolStripGrip.AccessibleRole = role; object actual = toolStripGrip.AccessibilityObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId); UiaCore.UIA expected = AccessibleRoleControlTypeMap.GetControlType(role); Assert.Equal(expected, actual); }
internal override object GetPropertyValue(UiaCore.UIA propertyID) { switch (propertyID) { // "ControlType" value depends on owner's AccessibleRole value. // See: docs/accessibility/accessible-role-controltype.md case UiaCore.UIA.ControlTypePropertyId: return(AccessibleRoleControlTypeMap.GetControlType(Role)); case UiaCore.UIA.NamePropertyId: return(Name); case UiaCore.UIA.IsExpandCollapsePatternAvailablePropertyId: return((object)IsPatternSupported(UiaCore.UIA.ExpandCollapsePatternId)); case UiaCore.UIA.IsEnabledPropertyId: return(_ownerItem.Enabled); case UiaCore.UIA.IsOffscreenPropertyId: return(GetIsOffscreenPropertyValue(_ownerItem.Placement, Bounds)); case UiaCore.UIA.IsKeyboardFocusablePropertyId: return(_ownerItem.CanSelect); case UiaCore.UIA.HasKeyboardFocusPropertyId: return(_ownerItem.Selected); case UiaCore.UIA.AccessKeyPropertyId: return(KeyboardShortcut); case UiaCore.UIA.IsPasswordPropertyId: return(false); case UiaCore.UIA.HelpTextPropertyId: return(Help ?? string.Empty); } return(base.GetPropertyValue(propertyID)); }
/// <summary> /// Gets the accessible property value. /// </summary> /// <param name="propertyID">The accessible property ID.</param> /// <returns>The accessible property value.</returns> internal override object?GetPropertyValue(UiaCore.UIA propertyID) { switch (propertyID) { // "ControlType" value depends on owner's AccessibleRole value. // See: docs/accessibility/accessible-role-controltype.md case UiaCore.UIA.ControlTypePropertyId: return(AccessibleRoleControlTypeMap.GetControlType(Role)); case UiaCore.UIA.IsEnabledPropertyId: return(_ownerItem.Enabled); case UiaCore.UIA.IsOffscreenPropertyId: return(GetIsOffscreenPropertyValue(_ownerItem.Placement, Bounds)); case UiaCore.UIA.IsKeyboardFocusablePropertyId: return(_ownerItem.CanSelect); case UiaCore.UIA.HasKeyboardFocusPropertyId: return(_ownerItem.Selected); } return(base.GetPropertyValue(propertyID)); }