mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Pt Run] Narrator support for result view navigation (#6146)
* Screen reader detecting List view * Fixed narrator text for listview items and context menu items * Renamed custom textbox to a more meanigful name * Renamed custom textbox to a more meanigful name * Fix formatting of LauncherControl.xaml * Added support to control multiple elements
This commit is contained in:
committed by
GitHub
parent
fc34c05a2f
commit
742f4fe36d
42
src/modules/launcher/PowerLauncher/CustomSearchBox.cs
Normal file
42
src/modules/launcher/PowerLauncher/CustomSearchBox.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace PowerLauncher
|
||||
{
|
||||
public class CustomSearchBox : TextBox
|
||||
{
|
||||
public List<UIElement> ControlledElements { get; } = new List<UIElement>();
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer()
|
||||
{
|
||||
return new AutoSuggestTextBoxAutomationPeer(this);
|
||||
}
|
||||
|
||||
internal class AutoSuggestTextBoxAutomationPeer : TextBoxAutomationPeer
|
||||
{
|
||||
public AutoSuggestTextBoxAutomationPeer(CustomSearchBox owner)
|
||||
: base(owner)
|
||||
{
|
||||
}
|
||||
|
||||
protected override List<AutomationPeer> GetControlledPeersCore()
|
||||
{
|
||||
var controlledPeers = new List<AutomationPeer>();
|
||||
foreach (UIElement controlledElement in ((CustomSearchBox)Owner).ControlledElements)
|
||||
{
|
||||
controlledPeers.Add(UIElementAutomationPeer.CreatePeerForElement(controlledElement));
|
||||
}
|
||||
|
||||
return controlledPeers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user