forked from unoplatform/uno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement
FlipViewAutomationPeer
- Loading branch information
1 parent
3c49843
commit f536856
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
src/Uno.UI/UI/Xaml/Automation/Peers/FlipViewAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference FlipViewAutomationPeer_Partial.cpp, tag winui3/release/1.5-stable | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.UI.Xaml.Automation.Peers; | ||
|
||
/// <summary> | ||
/// Exposes FlipView types to Microsoft UI Automation. | ||
/// </summary> | ||
public partial class FlipViewAutomationPeer : SelectorAutomationPeer | ||
{ | ||
public FlipViewAutomationPeer(Controls.FlipView owner) : base(owner) | ||
{ | ||
|
||
} | ||
|
||
protected override IList<AutomationPeer> GetChildrenCore() | ||
{ | ||
var children = base.GetChildrenCore(); | ||
|
||
if ((Owner as Controls.FlipView).SelectedItem is { } selectedItem) | ||
{ | ||
var itemPeer = CreateItemAutomationPeer(selectedItem); | ||
|
||
if (itemPeer is { }) | ||
{ | ||
var itemPeerAsAP = itemPeer as AutomationPeer; | ||
children.Add(itemPeerAsAP); | ||
|
||
if (children is { }) | ||
{ | ||
(var previousButton, var nextButton) = (Owner as Controls.FlipView).GetPreviousAndNextButtons(); | ||
|
||
if (nextButton is { }) | ||
{ | ||
var nextButtonAP = nextButton.GetOrCreateAutomationPeer(); | ||
|
||
if (nextButtonAP is { }) | ||
{ | ||
children.Insert(0, nextButtonAP); | ||
} | ||
} | ||
if (previousButton is { }) | ||
{ | ||
var previousButtonAP = previousButton.GetOrCreateAutomationPeer(); | ||
|
||
if (previousButtonAP is { }) | ||
{ | ||
children.Insert(0, previousButtonAP); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return children; | ||
} | ||
|
||
protected override string GetClassNameCore() => nameof(Controls.FlipView); | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
=> AutomationControlType.List;//UNO TODO: AutomationControlType.FlipView; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters