-
-
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 ComboBox #647
- Loading branch information
Showing
3 changed files
with
40 additions
and
1 deletion.
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
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 ComboBoxAutomationPeer : System.Windows.Automation.Peers.ComboBoxAutomationPeer | ||
{ | ||
/// <summary>Initializes a new instance of the <see cref="T:ComboBoxAutomationPeer" /> class.</summary> | ||
/// <param name="owner">The element associated with this automation peer.</param> | ||
public ComboBoxAutomationPeer([NotNull] ComboBox 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