diff --git a/Fluent.Ribbon/Automation/Peers/ButtonAutomationPeer.cs b/Fluent.Ribbon/Automation/Peers/ButtonAutomationPeer.cs
index 8a46be680..ddf8d3eaa 100644
--- a/Fluent.Ribbon/Automation/Peers/ButtonAutomationPeer.cs
+++ b/Fluent.Ribbon/Automation/Peers/ButtonAutomationPeer.cs
@@ -1,8 +1,7 @@
namespace Fluent.Automation.Peers
{
using JetBrains.Annotations;
- using Button = Fluent.Button;
-
+
///
public class ButtonAutomationPeer : System.Windows.Automation.Peers.ButtonAutomationPeer
{
diff --git a/Fluent.Ribbon/Automation/Peers/ToggleButtonAutomationPeer.cs b/Fluent.Ribbon/Automation/Peers/ToggleButtonAutomationPeer.cs
new file mode 100644
index 000000000..5a3a5bd8a
--- /dev/null
+++ b/Fluent.Ribbon/Automation/Peers/ToggleButtonAutomationPeer.cs
@@ -0,0 +1,32 @@
+namespace Fluent.Automation.Peers
+{
+ using JetBrains.Annotations;
+
+ ///
+ public class ToggleButtonAutomationPeer : System.Windows.Automation.Peers.ToggleButtonAutomationPeer
+ {
+ /// Initializes a new instance of the class.
+ /// The element associated with this automation peer.
+ public ToggleButtonAutomationPeer([NotNull] ToggleButton owner)
+ : base(owner)
+ {
+ }
+
+ ///
+ protected override string GetNameCore()
+ {
+ var text = base.GetNameCore();
+ var owner = (IHeaderedControl)this.Owner;
+
+ if (string.IsNullOrEmpty(text))
+ {
+ if (owner.Header is string headerString)
+ {
+ return headerString;
+ }
+ }
+
+ return text;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Fluent.Ribbon/Controls/ToggleButton.cs b/Fluent.Ribbon/Controls/ToggleButton.cs
index 9c65b7747..892e504f5 100644
--- a/Fluent.Ribbon/Controls/ToggleButton.cs
+++ b/Fluent.Ribbon/Controls/ToggleButton.cs
@@ -2,6 +2,7 @@
namespace Fluent
{
using System.Windows;
+ using System.Windows.Automation.Peers;
using System.Windows.Data;
using System.Windows.Markup;
using Fluent.Internal.KnownBoxes;
@@ -279,5 +280,11 @@ void ILogicalChildSupport.RemoveLogicalChild(object child)
{
this.RemoveLogicalChild(child);
}
+
+ ///
+ protected override AutomationPeer OnCreateAutomationPeer()
+ {
+ return new Fluent.Automation.Peers.ToggleButtonAutomationPeer(this);
+ }
}
}
\ No newline at end of file