Browse Source

Update GetNameCore logic to match WPF logic

pull/10531/head
Daniil Pavliuchyk 4 years ago
parent
commit
b65933b9d6
  1. 11
      src/Avalonia.Controls/Automation/Peers/LabelAutomationPeer.cs

11
src/Avalonia.Controls/Automation/Peers/LabelAutomationPeer.cs

@ -19,9 +19,16 @@ namespace Avalonia.Controls.Automation.Peers
return AutomationControlType.Text;
}
override protected string GetNameCore()
override protected string? GetNameCore()
{
return AccessText.RemoveAccessKeyMarker(((Label)Owner).Content as string) ?? string.Empty;
var content = ((Label)Owner).Content as string;
if (string.IsNullOrEmpty(content))
{
return base.GetNameCore();
}
return AccessText.RemoveAccessKeyMarker(content) ?? string.Empty;
}
}
}

Loading…
Cancel
Save