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

Commit a6b9482

Browse files
authored
Merge pull request #1083 from github/fixes/969-missing-automation-ids
Add an AutomationPeer to custom controls and views
2 parents ad6b434 + 6cc105b commit a6b9482

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows;
66
using System.Windows.Controls;
77
using System.Windows.Input;
8+
using System.Windows.Automation.Peers;
89
using GitHub.ViewModels;
910
using ReactiveUI;
1011

@@ -278,5 +279,15 @@ public void Dispose()
278279
Dispose(true);
279280
GC.SuppressFinalize(this);
280281
}
282+
283+
/// <summary>
284+
/// Add an automation peer to views and custom controls
285+
/// They do not have automation peers or properties by default
286+
/// https://stackoverflow.com/questions/30198109/automationproperties-automationid-on-custom-control-not-exposed
287+
/// </summary>
288+
protected override AutomationPeer OnCreateAutomationPeer()
289+
{
290+
return new UIElementAutomationPeer(this);
291+
}
281292
}
282293
}

0 commit comments

Comments
 (0)