From 777a9d8b88d43d59894493ce42d446ed35c7cae6 Mon Sep 17 00:00:00 2001 From: morning4coffe-dev <78549750+morning4coffe-dev@users.noreply.github.com> Date: Wed, 10 Jan 2024 23:53:39 +0100 Subject: [PATCH] feat: Implement `ListBoxItemDataAutomationPeer` --- .../ListBoxItemDataAutomationPeer.cs | 6 ++--- .../Peers/ListBoxItemDataAutomationPeer.cs | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/Uno.UI/UI/Xaml/Automation/Peers/ListBoxItemDataAutomationPeer.cs diff --git a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/ListBoxItemDataAutomationPeer.cs b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/ListBoxItemDataAutomationPeer.cs index be690d257909..f9ed37b85e4e 100644 --- a/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/ListBoxItemDataAutomationPeer.cs +++ b/src/Uno.UI/Generated/3.0.0.0/Microsoft.UI.Xaml.Automation.Peers/ListBoxItemDataAutomationPeer.cs @@ -3,12 +3,12 @@ #pragma warning disable 114 // new keyword hiding namespace Microsoft.UI.Xaml.Automation.Peers { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented] #endif public partial class ListBoxItemDataAutomationPeer : global::Microsoft.UI.Xaml.Automation.Peers.SelectorItemAutomationPeer, global::Microsoft.UI.Xaml.Automation.Provider.IScrollItemProvider { -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public ListBoxItemDataAutomationPeer(object item, global::Microsoft.UI.Xaml.Automation.Peers.ListBoxAutomationPeer parent) : base(item, parent) { @@ -16,7 +16,7 @@ public ListBoxItemDataAutomationPeer(object item, global::Microsoft.UI.Xaml.Auto } #endif // Forced skipping of method Microsoft.UI.Xaml.Automation.Peers.ListBoxItemDataAutomationPeer.ListBoxItemDataAutomationPeer(object, Microsoft.UI.Xaml.Automation.Peers.ListBoxAutomationPeer) -#if __ANDROID__ || __IOS__ || IS_UNIT_TESTS || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__ +#if false [global::Uno.NotImplemented("__ANDROID__", "__IOS__", "IS_UNIT_TESTS", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")] public void ScrollIntoView() { diff --git a/src/Uno.UI/UI/Xaml/Automation/Peers/ListBoxItemDataAutomationPeer.cs b/src/Uno.UI/UI/Xaml/Automation/Peers/ListBoxItemDataAutomationPeer.cs new file mode 100644 index 000000000000..c0b9c8962dfe --- /dev/null +++ b/src/Uno.UI/UI/Xaml/Automation/Peers/ListBoxItemDataAutomationPeer.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. +// MUX Reference ListBoxItemDataAutomationPeer_Partial.cpp, tag winui3/release/1.4.2 +namespace Microsoft.UI.Xaml.Automation.Peers; + +/// +/// Exposes ListBox items to Microsoft UI Automation, using a data representation of the item +/// so that the peer supports scrolling to that item with data awareness. +/// +public partial class ListBoxItemDataAutomationPeer : SelectorItemAutomationPeer, Provider.IScrollItemProvider +{ + public ListBoxItemDataAutomationPeer(object item, ListBoxAutomationPeer parent) : base(item, parent) + { + + } + + protected override string GetClassNameCore() => nameof(Controls.ListBoxItem); + + protected override AutomationControlType GetAutomationControlTypeCore() + => AutomationControlType.ListItem; + + public void ScrollIntoView() + { + ScrollIntoView(); + } +}