namespace Fluent.Automation.Peers
{
using System.Windows.Automation.Peers;
using JetBrains.Annotations;
///
public class RibbonButtonAutomationPeer : ButtonAutomationPeer
{
/// Initializes a new instance of the class.
/// The element associated with this automation peer.
public RibbonButtonAutomationPeer([NotNull] Button owner)
: base(owner)
{
}
///
protected override string GetClassNameCore()
{
return "RibbonButton";
}
///
protected override string GetNameCore()
{
var name = base.GetNameCore();
if (string.IsNullOrEmpty(name))
{
name = (this.Owner as IHeaderedControl)?.Header as string;
}
return name;
}
///
protected override string GetAccessKeyCore()
{
var text = ((Button)this.Owner).KeyTip;
if (string.IsNullOrEmpty(text))
{
text = base.GetAccessKeyCore();
}
return text;
}
///
protected override string GetHelpTextCore()
{
var text = base.GetHelpTextCore();
if (string.IsNullOrEmpty(text))
{
if (((Button)this.Owner).ToolTip is ScreenTip ribbonToolTip)
{
text = ribbonToolTip.Text;
}
}
return text;
}
}
}