diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Schema.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Schema.cs index e8cacb27ce6..38c2f02e4ad 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Schema.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Schema.cs @@ -18,6 +18,7 @@ using System.Diagnostics; using MS.Internal.Automation; + namespace MS.Internal.Automation { // Disable warning for obsolete types. These are scheduled to be removed in M8.2 so @@ -209,18 +210,34 @@ internal static object ConvertToElementArray(object value) return els; } - private enum HeadingLevel + private static object ConvertToAutomationHeadingLevel(object value) { - None = 80050, - Level1, - Level2, - Level3, - Level4, - Level5, - Level6, - Level7, - Level8, - Level9, + var headingLevel = (HeadingLevel)value; + switch(headingLevel) + { + case HeadingLevel.None: + return AutomationHeadingLevel.None; + case HeadingLevel.Level1: + return AutomationHeadingLevel.Level1; + case HeadingLevel.Level2: + return AutomationHeadingLevel.Level2; + case HeadingLevel.Level3: + return AutomationHeadingLevel.Level3; + case HeadingLevel.Level4: + return AutomationHeadingLevel.Level4; + case HeadingLevel.Level5: + return AutomationHeadingLevel.Level5; + case HeadingLevel.Level6: + return AutomationHeadingLevel.Level6; + case HeadingLevel.Level7: + return AutomationHeadingLevel.Level7; + case HeadingLevel.Level8: + return AutomationHeadingLevel.Level8; + case HeadingLevel.Level9: + return AutomationHeadingLevel.Level9; + default: + return AutomationHeadingLevel.None; + } } // Delegate versions of the above... @@ -238,6 +255,7 @@ private enum HeadingLevel private static AutomationPropertyConverter convertToElementArray = new AutomationPropertyConverter(ConvertToElementArray); private static AutomationPropertyConverter convertToControlType = new AutomationPropertyConverter(ConvertToControlType); private static AutomationPropertyConverter convertToCultureInfo = new AutomationPropertyConverter(ConvertToCultureInfo); + private static AutomationPropertyConverter convertToAutomationHeadingLevel = new AutomationPropertyConverter(ConvertToAutomationHeadingLevel); #endregion Private Methods @@ -288,7 +306,7 @@ private enum HeadingLevel new AutomationPropertyInfo( null, AutomationElement.ItemStatusProperty, typeof(string), "" ), new AutomationPropertyInfo( null, AutomationElement.SizeOfSetProperty, typeof(int), -1 ), new AutomationPropertyInfo( null, AutomationElement.PositionInSetProperty, typeof(int), -1 ), - new AutomationPropertyInfo( null, AutomationElement.HeadingLevelProperty, typeof(HeadingLevel), HeadingLevel.None ), + new AutomationPropertyInfo( convertToAutomationHeadingLevel, AutomationElement.HeadingLevelProperty, typeof(AutomationHeadingLevel),AutomationHeadingLevel.None ), new AutomationPropertyInfo( convertToBool, AutomationElement.IsDialogProperty, typeof(bool), false ), // Pattern Available properties diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/HeadingLevel.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/HeadingLevel.cs new file mode 100644 index 00000000000..ca6d18f9eba --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/HeadingLevel.cs @@ -0,0 +1,70 @@ + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +// +// +// +// Description: Enumeration for possible values of AutomationProperties.HeadingLevel +// + +namespace System.Windows.Automation +{ + /// + /// Describes the heading level of a control + /// + internal enum HeadingLevel + { + /// + /// The element does not have a heading level + /// + None = 80050, + + /// + /// The element has a heading level of 1 + /// + Level1, + + /// + /// The element has a heading level of 2 + /// + Level2, + + /// + /// The element has a heading level of 3 + /// + Level3, + + /// + /// The element has a heading level of 4 + /// + Level4, + + /// + /// The element has a heading level of 5 + /// + Level5, + + /// + /// The element has a heading level of 6 + /// + Level6, + + /// + /// The element has a heading level of 7 + /// + Level7, + + /// + /// The element has a heading level of 8 + /// + Level8, + + /// + /// The element has a heading level of 9 + /// + Level9, + } + +} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/PropertyCondition.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/PropertyCondition.cs index 0ebcac2433d..2c3eb8a13ca 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/PropertyCondition.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/PropertyCondition.cs @@ -173,6 +173,46 @@ void Init(AutomationProperty property, object val, PropertyConditionFlags flags { val = ((CultureInfo)val).LCID; } + else if (val is AutomationHeadingLevel) + { + AutomationHeadingLevel automationHeadingLevel = (AutomationHeadingLevel)(val); + switch(automationHeadingLevel) + { + case AutomationHeadingLevel.None: + val = HeadingLevel.None; + break; + case AutomationHeadingLevel.Level1: + val = HeadingLevel.Level1; + break; + case AutomationHeadingLevel.Level2: + val = HeadingLevel.Level2; + break; + case AutomationHeadingLevel.Level3: + val = HeadingLevel.Level3; + break; + case AutomationHeadingLevel.Level4: + val = HeadingLevel.Level4; + break; + case AutomationHeadingLevel.Level5: + val = HeadingLevel.Level5; + break; + case AutomationHeadingLevel.Level6: + val = HeadingLevel.Level6; + break; + case AutomationHeadingLevel.Level7: + val = HeadingLevel.Level7; + break; + case AutomationHeadingLevel.Level8: + val = HeadingLevel.Level8; + break; + case AutomationHeadingLevel.Level9: + val = HeadingLevel.Level9; + break; + default: + val = HeadingLevel.None; + break; + } + } _property = property; _val = val; diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/UIAutomationClient.csproj b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/UIAutomationClient.csproj index 2ccf4270b24..8fddd9cdc0b 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/UIAutomationClient.csproj +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/UIAutomationClient.csproj @@ -70,6 +70,7 @@ + @@ -95,6 +96,7 @@ + diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/ref/UIAutomationClient.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/ref/UIAutomationClient.cs index 2923ac6b042..45001f544f6 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/ref/UIAutomationClient.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/ref/UIAutomationClient.cs @@ -282,6 +282,19 @@ public partial struct GridPatternInformation public int RowCount { get { throw null; } } } } + internal enum HeadingLevel + { + None = 80050, + Level1, + Level2, + Level3, + Level4, + Level5, + Level6, + Level7, + Level8, + Level9, + } public partial class InvokePattern : System.Windows.Automation.BasePattern { internal InvokePattern() { }