-
-
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 CheckBox #647
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
namespace Fluent.Automation.Peers | ||
{ | ||
using JetBrains.Annotations; | ||
|
||
/// <inheritdoc /> | ||
public class CheckBoxAutomationPeer : System.Windows.Automation.Peers.ToggleButtonAutomationPeer | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="T:ToggleButtonAutomationPeer" /> class.</summary> | ||
/// <param name="owner">The element associated with this automation peer.</param> | ||
public CheckBoxAutomationPeer([NotNull] CheckBox 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