/// <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)
                {
                case UiaCore.UIA.ControlTypePropertyId:
                    // If we don't set a default role for the accessible object
                    // it will be retrieved from Windows.
                    // And we don't have a 100% guarantee it will be correct, hence set it ourselves.
                    return(_owningComboBox.AccessibleRole == AccessibleRole.Default
                               ? UiaCore.UIA.ComboBoxControlTypeId
                               : base.GetPropertyValue(propertyID));

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(_owningComboBox.Focused);

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
Exemple #2
0
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.NamePropertyId:
                    return(Name);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return((State & AccessibleStates.Focused) == AccessibleStates.Focused);    // Announce the cell when focusing.

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(_owner.DataGridView.Enabled);

                case UiaCore.UIA.AutomationIdPropertyId:
                    return(AutomationId);

                case UiaCore.UIA.HelpTextPropertyId:
                    return(Help ?? string.Empty);

                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                    return((State & AccessibleStates.Focusable) == AccessibleStates.Focusable);

                case UiaCore.UIA.IsPasswordPropertyId:
                    return(false);

                case UiaCore.UIA.IsOffscreenPropertyId:
                    return((State & AccessibleStates.Offscreen) == AccessibleStates.Offscreen);

                case UiaCore.UIA.AccessKeyPropertyId:
                    return(string.Empty);

                case UiaCore.UIA.GridItemContainingGridPropertyId:
                    return(Owner.DataGridView.AccessibilityObject);

                case UiaCore.UIA.IsTableItemPatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.TableItemPatternId));

                case UiaCore.UIA.IsGridItemPatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.GridItemPatternId));
                }

                return(base.GetPropertyValue(propertyID));
            }
Exemple #3
0
            internal override bool IsPatternSupported(UiaCore.UIA patternId)
            {
                if (patternId == UiaCore.UIA.ExpandCollapsePatternId)
                {
                    if (_owningComboBox.DropDownStyle == ComboBoxStyle.Simple)
                    {
                        return(false);
                    }

                    return(true);
                }

                if (patternId == UiaCore.UIA.ValuePatternId)
                {
                    return(true);
                }

                return(base.IsPatternSupported(patternId));
            }
Exemple #4
0
            internal override bool IsPatternSupported(UiaCore.UIA patternId)
            {
                if (patternId == UiaCore.UIA.LegacyIAccessiblePatternId ||
                    patternId == UiaCore.UIA.InvokePatternId ||
                    patternId == UiaCore.UIA.ValuePatternId)
                {
                    return(true);
                }

                if ((patternId == UiaCore.UIA.TableItemPatternId ||
                     patternId == UiaCore.UIA.GridItemPatternId) &&
                    // We don't want to implement patterns for header cells
                    owner.ColumnIndex != -1 && owner.RowIndex != -1)
                {
                    return(true);
                }

                return(base.IsPatternSupported(patternId));
            }
Exemple #5
0
        internal override object GetPropertyValue(UiaCore.UIA propertyID)
        {
            switch (propertyID)
            {
            case UiaCore.UIA.ControlTypePropertyId:
                return(UiaCore.UIA.ButtonControlTypeId);

            case UiaCore.UIA.NamePropertyId:
                return(Name);

            case UiaCore.UIA.IsLegacyIAccessiblePatternAvailablePropertyId:
                return(true);

            case UiaCore.UIA.LegacyIAccessibleRolePropertyId:
                return(Role);

            default:
                return(base.GetPropertyValue(propertyID));
            }
        }
            internal override object?GetPropertyValue(UiaCore.UIA propertyId)
            {
                switch (propertyId)
                {
                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(false);

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(_ownerDataGridView is null ? throw new InvalidOperationException(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet) : _ownerDataGridView.Enabled);

                case UiaCore.UIA.IsOffscreenPropertyId:
                    return(false);

                case UiaCore.UIA.IsContentElementPropertyId:
                    return(true);
                }

                return(base.GetPropertyValue(propertyId));
            }
Exemple #7
0
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.IsTogglePatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.TogglePatternId));

                case UiaCore.UIA.LocalizedControlTypePropertyId:
                    // We define a custom "LocalizedControlType" by default.
                    // If DateTimePicker.AccessibleRole value is customized by a user
                    // then "LocalizedControlType" value will be based on "ControlType"
                    // which depends on DateTimePicker.AccessibleRole.
                    return(Owner.AccessibleRole == AccessibleRole.Default
                               ? s_dateTimePickerLocalizedControlTypeString
                               : base.GetPropertyValue(propertyID));

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
Exemple #8
0
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.RuntimeIdPropertyId:
                    return(RuntimeId);

                case UiaCore.UIA.BoundingRectanglePropertyId:
                    return(BoundingRectangle);

                case UiaCore.UIA.ControlTypePropertyId:
                    return(UiaCore.UIA.ButtonControlTypeId);

                case UiaCore.UIA.NamePropertyId:
                    return(Name);

                case UiaCore.UIA.AccessKeyPropertyId:
                    return(KeyboardShortcut);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(_owner.Focused);

                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                    return((State & AccessibleStates.Focusable) == AccessibleStates.Focusable);

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(_owner.Enabled);

                case UiaCore.UIA.HelpTextPropertyId:
                    return(Help ?? string.Empty);

                case UiaCore.UIA.IsPasswordPropertyId:
                    return(false);

                case UiaCore.UIA.IsOffscreenPropertyId:
                    return((State & AccessibleStates.Offscreen) == AccessibleStates.Offscreen);

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
Exemple #9
0
            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)
                {
                case UiaCore.UIA.ControlTypePropertyId:
                    return(UiaCore.UIA.ListControlTypeId);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(false);    // Narrator should keep the keyboard focus on th ComboBox itself but not on the DropDown.

                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                    return((State & AccessibleStates.Focusable) == AccessibleStates.Focusable);

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(_owningComboBox.Enabled);

                case UiaCore.UIA.AutomationIdPropertyId:
                    return(COMBO_BOX_LIST_AUTOMATION_ID);

                case UiaCore.UIA.NativeWindowHandlePropertyId:
                    return(_childListControlhandle);

                case UiaCore.UIA.IsOffscreenPropertyId:
                    return(false);

                case UiaCore.UIA.IsSelectionPatternAvailablePropertyId:
                    return(true);

                case UiaCore.UIA.SelectionCanSelectMultiplePropertyId:
                    return(CanSelectMultiple);

                case UiaCore.UIA.SelectionIsSelectionRequiredPropertyId:
                    return(IsSelectionRequired);

                default:
                    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)
                {
                case UiaCore.UIA.ControlTypePropertyId:
                    return(UiaCore.UIA.TextControlTypeId);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(_owner.Focused);

                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                    return((State & AccessibleStates.Focusable) == AccessibleStates.Focusable);

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(_owner.Enabled);

                case UiaCore.UIA.IsOffscreenPropertyId:
                    return(false);

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.RuntimeIdPropertyId:
                    return(RuntimeId);

                case UiaCore.UIA.NamePropertyId:
                    return(Name);

                case UiaCore.UIA.BoundingRectanglePropertyId:
                    return(Bounds);

                case UiaCore.UIA.LegacyIAccessibleStatePropertyId:
                    return(State);

                case UiaCore.UIA.LegacyIAccessibleRolePropertyId:
                    return(Role);

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
                internal override object?GetPropertyValue(UiaCore.UIA propertyID)
                {
                    switch (propertyID)
                    {
                    case UiaCore.UIA.RuntimeIdPropertyId:
                        return(RuntimeId);

                    case UiaCore.UIA.ControlTypePropertyId:
                        return(UiaCore.UIA.EditControlTypeId);

                    case UiaCore.UIA.NamePropertyId:
                        return(Name);

                    case UiaCore.UIA.HasKeyboardFocusPropertyId:
                        return(Owner.Focused);

                    case UiaCore.UIA.IsEnabledPropertyId:
                        return(!IsReadOnly);

                    case UiaCore.UIA.ClassNamePropertyId:
                        return(Owner.GetType().ToString());

                    case UiaCore.UIA.FrameworkIdPropertyId:
                        return(NativeMethods.WinFormFrameworkId);

                    case UiaCore.UIA.IsValuePatternAvailablePropertyId:
                        return(IsPatternSupported(UiaCore.UIA.ValuePatternId));

                    case UiaCore.UIA.IsTextPatternAvailablePropertyId:
                        return(IsPatternSupported(UiaCore.UIA.TextPatternId));

                    case UiaCore.UIA.IsTextPattern2AvailablePropertyId:
                        return(IsPatternSupported(UiaCore.UIA.TextPattern2Id));
                    }

                    return(base.GetPropertyValue(propertyID));
                }
Exemple #14
0
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.BoundingRectanglePropertyId:
                    return(BoundingRectangle);

                case UiaCore.UIA.ControlTypePropertyId:
                    return(UiaCore.UIA.ListControlTypeId);

                case UiaCore.UIA.NamePropertyId:
                    return(Name);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    bool result = _owningListBox.HasKeyboardFocus && _owningListBox.Focused;
                    if (GetChildCount() > 0)
                    {
                        _owningListBox.HasKeyboardFocus = false;
                    }
                    return(result);

                case UiaCore.UIA.NativeWindowHandlePropertyId:
                    return(_owningListBox.Handle);

                case UiaCore.UIA.IsSelectionPatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.SelectionPatternId));

                case UiaCore.UIA.IsScrollPatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.ScrollPatternId));

                case UiaCore.UIA.IsLegacyIAccessiblePatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.LegacyIAccessiblePatternId));

                default:
                    return(base.GetPropertyValue(propertyID));
                }
            }
Exemple #15
0
            /// <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));
            }
Exemple #16
0
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 {
     return(patternId == UiaCore.UIA.LegacyIAccessiblePatternId ||
            patternId == UiaCore.UIA.InvokePatternId ||
            base.IsPatternSupported(patternId));
 }
 internal static void False(AccessibleObject accessibleObject, UiaCore.UIA propertyId)
 {
     Assert.False((bool)accessibleObject.GetPropertyValue(propertyId));
 }
Exemple #18
0
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 => (patternId == UiaCore.UIA.TogglePatternId && ((DateTimePicker)Owner).ShowCheckBox) ||
 patternId == UiaCore.UIA.ExpandCollapsePatternId ||
 base.IsPatternSupported(patternId);
 internal override object GetPropertyValue(UiaCore.UIA propertyID)
 {
     return(propertyID == UiaCore.UIA.NamePropertyId
         ? Name
         : base.GetPropertyValue(propertyID));
 }
Exemple #20
0
 internal override object?GetPropertyValue(UiaCore.UIA propertyID)
 {
     return(_accessibleObject.GetPropertyValue(propertyID));
 }
Exemple #21
0
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 {
     return(patternId.Equals(UiaCore.UIA.LegacyIAccessiblePatternId));
 }
 /// <inheritdoc />
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 => patternId == UiaCore.UIA.InvokePatternId || base.IsPatternSupported(patternId);
Exemple #23
0
            internal override object GetPropertyValue(UiaCore.UIA propertyID)
            {
                switch (propertyID)
                {
                case UiaCore.UIA.NamePropertyId:
                    return(Name);

                case UiaCore.UIA.HasKeyboardFocusPropertyId:
                    return(false);    // Only inner cell should be announced as focused by Narrator but not entire DGV.

                case UiaCore.UIA.IsKeyboardFocusablePropertyId:
                    return(owner.CanFocus);

                case UiaCore.UIA.IsEnabledPropertyId:
                    return(owner.Enabled);

                case UiaCore.UIA.IsControlElementPropertyId:
                    return(true);

                case UiaCore.UIA.IsTablePatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.TablePatternId));

                case UiaCore.UIA.IsGridPatternAvailablePropertyId:
                    return(IsPatternSupported(UiaCore.UIA.GridPatternId));

                case UiaCore.UIA.ControlTypePropertyId:
                    return(UiaCore.UIA.TableControlTypeId);

                case UiaCore.UIA.ItemStatusPropertyId:
                    // Whether the owner DataGridView can be sorted by some column.
                    // If so, provide not-sorted/sorted-by item status.
                    bool canSort = false;
                    for (int i = 0; i < owner.Columns.Count; i++)
                    {
                        if (owner.IsSortable(owner.Columns[i]))
                        {
                            canSort = true;
                            break;
                        }
                    }

                    if (canSort)
                    {
                        switch (owner.SortOrder)
                        {
                        case SortOrder.None:
                            return(SR.NotSortedAccessibleStatus);

                        case SortOrder.Ascending:
                            return(string.Format(SR.DataGridViewSortedAscendingAccessibleStatusFormat, owner.SortedColumn?.HeaderText));

                        case SortOrder.Descending:
                            return(string.Format(SR.DataGridViewSortedDescendingAccessibleStatusFormat, owner.SortedColumn?.HeaderText));
                        }
                    }

                    break;
                }

                return(base.GetPropertyValue(propertyID));
            }
Exemple #24
0
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 {
     return(_accessibleObject.IsPatternSupported(patternId));
 }
 internal override object?GetPropertyValue(UiaCore.UIA propertyID)
 => propertyID == UiaCore.UIA.NamePropertyId
         ? SR.PropertyGridViewDropDownControlHolderAccessibleName
         : base.GetPropertyValue(propertyID);
Exemple #26
0
 internal override object?GetPropertyValue(UiaCore.UIA propertyID)
 => propertyID switch
 {
Exemple #27
0
 internal override object?GetPropertyValue(UiaCore.UIA propertyID)
 => propertyID == UiaCore.UIA.ControlTypePropertyId
         ? UiaCore.UIA.ButtonControlTypeId
         : base.GetPropertyValue(propertyID);
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 => patternId == UiaCore.UIA.ExpandCollapsePatternId ? true : base.IsPatternSupported(patternId);
Exemple #29
0
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 => patternId switch
 {
 internal override bool IsPatternSupported(UiaCore.UIA patternId)
 {
     return((patternId == UiaCore.UIA.TablePatternId && RowCount > 0) ||
            patternId == UiaCore.UIA.GridPatternId ||
            base.IsPatternSupported(patternId));
 }