Skip to content

Commit 5c4eac5

Browse files
committed
Narrator improvements to SettingsCard
1 parent ccc5935 commit 5c4eac5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

labs/SettingsControls/src/SettingsCard/SettingsCard.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ private void RegisterAutomation()
5555
if (!string.IsNullOrEmpty(headerString))
5656
{
5757
AutomationProperties.SetName(this, headerString);
58-
}
5958

60-
if (Content != null && Content.GetType() != typeof(Button))
61-
{
62-
// We do not want to override the default AutomationProperties.Name of a button. Its Content property already describes what it does.
63-
if (!string.IsNullOrEmpty(headerString))
59+
// We don't want to override an AutomationProperties.Name that is manually set, or if the Content basetype is of type ButtonBase (the ButtonBase.Content will be used then)
60+
if (Content != null && string.IsNullOrEmpty(AutomationProperties.GetName((UIElement)Content)) && Content.GetType().BaseType != typeof(ButtonBase))
6461
{
6562
AutomationProperties.SetName((UIElement)Content, headerString);
6663
}

0 commit comments

Comments
 (0)