Files
aistudio-wpf-diagram/Others/Fluent.Ribbon/Fluent.Ribbon/Automation/Peers/RibbonHeaderedControlAutomationPeer.cs
2023-04-16 20:11:40 +08:00

39 lines
1.0 KiB
C#

namespace Fluent.Automation.Peers
{
using System.Windows;
using System.Windows.Automation.Peers;
using JetBrains.Annotations;
/// <summary>
/// Base automation peer for <see cref="IHeaderedControl"/>.
/// </summary>
public abstract class RibbonHeaderedControlAutomationPeer : FrameworkElementAutomationPeer
{
/// <summary>
/// Creates a new instance.
/// </summary>
protected RibbonHeaderedControlAutomationPeer([NotNull] FrameworkElement owner)
: base(owner)
{
}
/// <inheritdoc />
protected override string GetClassNameCore()
{
return this.Owner.GetType().Name;
}
/// <inheritdoc />
protected override string GetNameCore()
{
var name = base.GetNameCore();
if (string.IsNullOrEmpty(name))
{
name = (this.Owner as IHeaderedControl)?.Header as string;
}
return name;
}
}
}