Search code examples
accessibilitymaui

How are AutomationPeers used in a .NET Maui Windows app?


Are there any resources showing how to use AutomationPeers in an .NET Maui Windows app? Traditional Xamarin apps would use Windows.UI.Xaml.Automation.Peers, but I can't find mention of peers up at resources such as https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/accessibility.


Solution

  • Use Microsoft.UI.Xaml.Automation.Peers instead of Windows.UI.Xaml.Automation.Peers .

    This namespace requires the Microsoft.UI.Xaml.Controls NuGet package

    Check if the package has been installed in your project .

    Refer to

    https://learn.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.automation.peers?view=winui-3.0

    https://learn.microsoft.com/en-us/windows/win32/winauto/entry-uiauto-win32