committed by
GitHub
2 changed files with 42 additions and 1 deletions
@ -0,0 +1,34 @@ |
|||||
|
using Avalonia.Automation.Peers; |
||||
|
using Avalonia.Controls.Primitives; |
||||
|
|
||||
|
namespace Avalonia.Controls.Automation.Peers |
||||
|
{ |
||||
|
public class LabelAutomationPeer : ControlAutomationPeer |
||||
|
{ |
||||
|
public LabelAutomationPeer(Label owner) : base(owner) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
override protected string GetClassNameCore() |
||||
|
{ |
||||
|
return "Text"; |
||||
|
} |
||||
|
|
||||
|
override protected AutomationControlType GetAutomationControlTypeCore() |
||||
|
{ |
||||
|
return AutomationControlType.Text; |
||||
|
} |
||||
|
|
||||
|
override protected string? GetNameCore() |
||||
|
{ |
||||
|
var content = ((Label)Owner).Content as string; |
||||
|
|
||||
|
if (string.IsNullOrEmpty(content)) |
||||
|
{ |
||||
|
return base.GetNameCore(); |
||||
|
} |
||||
|
|
||||
|
return AccessText.RemoveAccessKeyMarker(content) ?? string.Empty; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue