Skip to content

Commit 146174a

Browse files
committed
Narrator improvements
1 parent 5c4eac5 commit 146174a

File tree

4 files changed

+11
-23
lines changed

4 files changed

+11
-23
lines changed

labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Description>
1919
This package contains the SettingsCard and SettingsExpander controls.
2020
</Description>
21-
<Version>0.0.8</Version>
21+
<Version>0.0.9</Version>
2222
<LangVersion>10.0</LangVersion>
2323
</PropertyGroup>
2424

labs/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class SettingsExpander
4040
/// </summary>
4141
public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
4242
nameof(Content),
43-
typeof(UIElement),
43+
typeof(object),
4444
typeof(SettingsExpander),
4545
new PropertyMetadata(defaultValue: null));
4646

@@ -87,9 +87,9 @@ public IconElement HeaderIcon
8787
/// <summary>
8888
/// Gets or sets the Content.
8989
/// </summary>
90-
public UIElement Content
90+
public object Content
9191
{
92-
get => (UIElement)GetValue(ContentProperty);
92+
get => (object)GetValue(ContentProperty);
9393
set => SetValue(ContentProperty, value);
9494
}
9595

labs/SettingsControls/src/SettingsExpander/SettingsExpander.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ private void RegisterAutomation()
3030
if (Header != null && Header.GetType() == typeof(string))
3131
{
3232
string? headerString = Header.ToString();
33-
if (!string.IsNullOrEmpty(headerString))
33+
if (!string.IsNullOrEmpty(headerString) && string.IsNullOrEmpty(AutomationProperties.GetName(this)))
3434
{
3535
AutomationProperties.SetName(this, headerString);
3636
}
37-
38-
if (Content != null && Content.GetType() != typeof(Button))
39-
{
40-
// We do not want to override the default AutomationProperties.Name of a button. Its Content property already describes what it does.
41-
if (!string.IsNullOrEmpty(headerString))
42-
{
43-
AutomationProperties.SetName((UIElement)Content, headerString);
44-
}
45-
}
4637
}
47-
4838
}
4939

5040
/// <summary>

labs/SettingsControls/src/SettingsExpander/SettingsExpander.xaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- 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. -->
1+
<!-- 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. -->
22
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
@@ -53,8 +53,6 @@
5353
<Setter Property="BorderThickness" Value="{ThemeResource SettingsCardBorderThickness}" />
5454
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
5555
<Setter Property="MinHeight" Value="{ThemeResource SettingsCardMinHeight}" />
56-
<!--<Setter Property="win:AutomationProperties.AutomationControlType" Value="Group" />-->
57-
<!--<Setter Property="win:AutomationProperties.Name" Value="{TemplateBinding Header}" />-->
5856
<Setter Property="MaxWidth" Value="{ThemeResource SettingsCardMaxWidth}" />
5957
<Setter Property="MinWidth" Value="{ThemeResource SettingsCardMinWidth}" />
6058
<Setter Property="IsTabStop" Value="False" />
@@ -75,8 +73,9 @@
7573
<muxc:Expander MaxWidth="{TemplateBinding MaxWidth}"
7674
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
7775
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
76+
win:AutomationProperties.HelpText="{TemplateBinding AutomationProperties.HelpText}"
77+
win:AutomationProperties.Name="{TemplateBinding AutomationProperties.Name}"
7878
IsExpanded="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
79-
IsTabStop="False"
8079
Style="{StaticResource SettingsExpanderExpanderStyle}">
8180
<muxc:Expander.Header>
8281
<labs:SettingsCard Padding="{StaticResource SettingsExpanderHeaderPadding}"
@@ -101,7 +100,6 @@
101100

102101
<Style x:Key="SettingsExpanderExpanderStyle"
103102
TargetType="muxc:Expander">
104-
<Setter Property="IsTabStop" Value="False" />
105103
<Setter Property="Background" Value="{ThemeResource ExpanderContentBackground}" />
106104
<Setter Property="BackgroundSizing" Value="InnerBorderEdge" />
107105
<Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
@@ -230,6 +228,7 @@
230228
HorizontalContentAlignment="{StaticResource ExpanderHeaderHorizontalContentAlignment}"
231229
VerticalContentAlignment="{StaticResource ExpanderHeaderVerticalContentAlignment}"
232230
win:AutomationProperties.AutomationId="ExpanderToggleButton"
231+
win:AutomationProperties.Name="{TemplateBinding AutomationProperties.Name}"
233232
BackgroundSizing="{TemplateBinding BackgroundSizing}"
234233
BorderBrush="{ThemeResource ExpanderHeaderBorderBrush}"
235234
BorderThickness="{ThemeResource ExpanderHeaderBorderThickness}"
@@ -239,7 +238,7 @@
239238
CornerRadius="{TemplateBinding CornerRadius}"
240239
IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
241240
IsEnabled="{TemplateBinding IsEnabled}"
242-
IsTabStop="False"
241+
IsTabStop="True"
243242
Style="{StaticResource SettingsExpanderHeaderDownStyle}" />
244243
<!-- The clip is a composition clip applied in code -->
245244
<Border x:Name="ExpanderContentClip"
@@ -523,13 +522,12 @@
523522
VerticalAlignment="Center"
524523
HorizontalContentAlignment="Center"
525524
VerticalContentAlignment="Center"
526-
win:AutomationProperties.Name="{StaticResource SettingsExpanderChevronToolTip}"
527525
Background="{ThemeResource ExpanderChevronBackground}"
528526
BorderBrush="{ThemeResource ExpanderChevronBorderBrush}"
529527
BorderThickness="{ThemeResource ExpanderChevronBorderThickness}"
530528
CornerRadius="{ThemeResource ControlCornerRadius}"
531529
FocusVisualMargin="-3"
532-
IsTabStop="True"
530+
IsTabStop="False"
533531
ToolTipService.ToolTip="{StaticResource SettingsExpanderChevronToolTip}"
534532
UseSystemFocusVisuals="True">
535533
<muxc:AnimatedIcon x:Name="ExpandCollapseChevron"

0 commit comments

Comments
 (0)