Skip to content

Commit 168e0af

Browse files
authored
WIP (#27052)
1 parent e1c5061 commit 168e0af

File tree

2 files changed

+34
-55
lines changed

2 files changed

+34
-55
lines changed

src/Controls/src/Core/Platform/Windows/Extensions/AccessibilityExtensions.cs

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
2525
_defaultAutomationPropertiesName = currentValue = (string)Control.GetValue(NativeAutomationProperties.NameProperty);
2626
}
2727

28-
#pragma warning disable CS0618 // Type or member is obsolete
29-
var elemValue = (string)Element.GetValue(AutomationProperties.NameProperty);
30-
#pragma warning restore CS0618 // Type or member is obsolete
31-
28+
var elemValue = (string)Element.GetValue(SemanticProperties.DescriptionProperty);
3229
string newValue = !string.IsNullOrWhiteSpace(elemValue) ? elemValue : _defaultAutomationPropertiesName;
3330

3431
if (currentValue is null || currentValue != newValue)
@@ -88,10 +85,7 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
8885
_defaultAutomationPropertiesHelpText = currentValue = (string)Control.GetValue(NativeAutomationProperties.HelpTextProperty);
8986
}
9087

91-
#pragma warning disable CS0618 // Type or member is obsolete
92-
var elemValue = (string)Element.GetValue(AutomationProperties.HelpTextProperty);
93-
#pragma warning restore CS0618 // Type or member is obsolete
94-
88+
var elemValue = (string)Element.GetValue(SemanticProperties.HintProperty);
9589
string newValue = !string.IsNullOrWhiteSpace(elemValue) ? elemValue : _defaultAutomationPropertiesHelpText;
9690

9791
if (currentValue is null || newValue != currentValue)
@@ -123,9 +117,8 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
123117
{
124118
_defaultAutomationPropertiesLabeledBy = currentValue = (UIElement)Control.GetValue(NativeAutomationProperties.LabeledByProperty);
125119
}
126-
#pragma warning disable CS0618 // Type or member is obsolete
127-
var elemValue = (VisualElement)Element.GetValue(AutomationProperties.LabeledByProperty);
128-
#pragma warning restore CS0618 // Type or member is obsolete
120+
121+
var elemValue = (VisualElement)Element.GetValue(SemanticProperties.DescriptionProperty);
129122
FrameworkElement? nativeElement = null;
130123

131124
if (mauiContext != null)
@@ -137,9 +130,7 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
137130

138131
if (currentValue is null || newValue != currentValue)
139132
{
140-
#pragma warning disable CS0618 // Type or member is obsolete
141-
Control.SetValue(AutomationProperties.LabeledByProperty, newValue);
142-
#pragma warning restore CS0618 // Type or member is obsolete
133+
Control.SetValue(SemanticProperties.DescriptionProperty, newValue);
143134
}
144135

145136
return _defaultAutomationPropertiesLabeledBy;
@@ -161,22 +152,10 @@ public static void SetBackButtonTitle(this PageControl Control, Element? Element
161152

162153
static string ConcatenateNameAndHint(Element Element)
163154
{
164-
string separator;
165-
166-
#pragma warning disable CS0618 // Type or member is obsolete
167-
var name = (string)Element.GetValue(AutomationProperties.NameProperty);
168-
169-
var hint = (string)Element.GetValue(AutomationProperties.HelpTextProperty);
170-
#pragma warning restore CS0618 // Type or member is obsolete
155+
var name = (string)Element.GetValue(SemanticProperties.DescriptionProperty);
156+
var hint = (string)Element.GetValue(SemanticProperties.HintProperty);
171157

172-
if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(hint))
173-
{
174-
separator = "";
175-
}
176-
else
177-
{
178-
separator = ". ";
179-
}
158+
string separator = string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(hint) ? "" : ". ";
180159

181160
return string.Join(separator, name, hint);
182161

src/Core/src/Handlers/IElementHandler.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,49 @@
66
/// </summary>
77
public interface IElementHandler
88
{
9-
/// <summary>
9+
/// <summary>
1010
/// Sets the .NET MAUI context for the element handler.
11-
/// </summary>
12-
/// <param name="mauiContext">The .NET MAUI context to set.</param>
11+
/// </summary>
12+
/// <param name="mauiContext">The .NET MAUI context to set.</param>
1313
void SetMauiContext(IMauiContext mauiContext);
1414

15-
/// <summary>
15+
/// <summary>
1616
/// Sets the cross-platform virtual view associated with the handler.
17-
/// </summary>
18-
/// <param name="view">The element to handle.</param>
17+
/// </summary>
18+
/// <param name="view">The element to handle.</param>
1919
void SetVirtualView(IElement view);
2020

21-
/// <summary>
22-
/// Updates the value of the specified property on the handler.
23-
/// </summary>
24-
/// <param name="property">The name of the property to update.</param>
21+
/// <summary>
22+
/// Updates the value of the specified property on the handler.
23+
/// </summary>
24+
/// <param name="property">The name of the property to update.</param>
2525
void UpdateValue(string property);
2626

27-
/// <summary>
28-
/// Invokes the specified command on the element with the given arguments.
29-
/// </summary>
30-
/// <param name="command">The name of the command to invoke.</param>
31-
/// <param name="args">Optional arguments to pass to the command.</param>
27+
/// <summary>
28+
/// Invokes the specified command on the element with the given arguments.
29+
/// </summary>
30+
/// <param name="command">The name of the command to invoke.</param>
31+
/// <param name="args">Optional arguments to pass to the command.</param>
3232
void Invoke(string command, object? args = null);
3333

34-
/// <summary>
34+
/// <summary>
3535
/// Disconnects the element handler from the element for clean up.
36-
/// </summary>
36+
/// </summary>
3737
void DisconnectHandler();
3838

39-
/// <summary>
40-
/// Gets the platform-specific view object associated with the handler.
41-
/// </summary>
39+
/// <summary>
40+
/// Gets the platform-specific view object associated with the handler.
41+
/// </summary>
4242
object? PlatformView { get; }
4343

44-
/// <summary>
45-
/// Gets the cross-platform virtual view associated with the handler.
46-
/// </summary>
44+
/// <summary>
45+
/// Gets the cross-platform virtual view associated with the handler.
46+
/// </summary>
4747
IElement? VirtualView { get; }
4848

49-
/// <summary>
50-
/// Gets the .NET MAUI context associated with the element.
51-
/// </summary>
49+
/// <summary>
50+
/// Gets the .NET MAUI context associated with the element.
51+
/// </summary>
5252
IMauiContext? MauiContext { get; }
5353
}
5454
}

0 commit comments

Comments
 (0)