Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 897ad36

Browse files
committed
add an automation peer
1 parent 2ad7b46 commit 897ad36

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/GitHub.UI.Reactive/Controls/ViewBase.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using GitHub.ViewModels;
99
using NullGuard;
1010
using ReactiveUI;
11+
using System.Windows.Automation.Peers;
12+
using System.Windows.Automation;
1113

1214
namespace GitHub.UI
1315
{
@@ -288,5 +290,15 @@ public void Dispose()
288290
Dispose(true);
289291
GC.SuppressFinalize(this);
290292
}
293+
294+
/// <summary>
295+
/// Add an automation peer to views and custom controls
296+
/// They do not have automation peers or properties by default
297+
/// https://stackoverflow.com/questions/30198109/automationproperties-automationid-on-custom-control-not-exposed
298+
/// </summary>
299+
protected override AutomationPeer OnCreateAutomationPeer()
300+
{
301+
return new UIElementAutomationPeer(this);
302+
}
291303
}
292304
}

0 commit comments

Comments
 (0)