-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3149 from MahApps/feature/GH-2527_CodedUI_and_Flyout
Add FlyoutAutomationPeer for better CodedUI support
- Loading branch information
Showing
4 changed files
with
62 additions
and
3 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
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
43 changes: 43 additions & 0 deletions
43
src/MahApps.Metro/MahApps.Metro.Shared/Controls/FlyoutAutomationPeer.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,43 @@ | ||
using System.Windows.Automation.Peers; | ||
|
||
namespace MahApps.Metro.Controls | ||
{ | ||
public class FlyoutAutomationPeer : FrameworkElementAutomationPeer | ||
{ | ||
public FlyoutAutomationPeer(Flyout owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
protected override string GetClassNameCore() | ||
{ | ||
return "Flyout"; | ||
} | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.Custom; | ||
} | ||
|
||
protected override string GetNameCore() | ||
{ | ||
string nameCore = base.GetNameCore(); | ||
if (string.IsNullOrEmpty(nameCore)) | ||
{ | ||
nameCore = ((Flyout)this.Owner).Header as string; | ||
} | ||
|
||
if (string.IsNullOrEmpty(nameCore)) | ||
{ | ||
nameCore = ((Flyout)this.Owner).Name; | ||
} | ||
|
||
if (string.IsNullOrEmpty(nameCore)) | ||
{ | ||
nameCore = GetClassNameCore(); | ||
} | ||
|
||
return nameCore; | ||
} | ||
} | ||
} |
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