-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding automation peer for ToggleButton #647
- Loading branch information
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
Fluent.Ribbon/Automation/Peers/ToggleButtonAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Fluent.Automation.Peers | ||
{ | ||
using JetBrains.Annotations; | ||
|
||
/// <inheritdoc /> | ||
public class ToggleButtonAutomationPeer : System.Windows.Automation.Peers.ToggleButtonAutomationPeer | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="T:TextBoxAutomationPeer" /> class.</summary> | ||
/// <param name="owner">The element associated with this automation peer.</param> | ||
public ToggleButtonAutomationPeer([NotNull] ToggleButton owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters