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.
- Loading branch information
1 parent
ae43868
commit bb1b1ea
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
src/Uno.UI/UI/Xaml/Automation/Peers/RepeatButtonAutomationPeer.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,37 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
// MUX Reference RepeatButtonAutomationPeer_Partial.cpp, tag winui3/release/1.4.2 | ||
|
||
using System; | ||
using Windows.UI.Xaml.Automation.Provider; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
|
||
namespace Windows.UI.Xaml.Automation.Peers; | ||
|
||
public partial class RepeatButtonAutomationPeer : ButtonBaseAutomationPeer, IInvokeProvider | ||
{ | ||
public RepeatButtonAutomationPeer(RepeatButton owner) : base(owner) | ||
{ | ||
} | ||
|
||
protected override object GetPatternCore(PatternInterface patternInterface) => | ||
patternInterface == PatternInterface.Invoke ? | ||
this : base.GetPatternCore(patternInterface); | ||
|
||
protected override string GetClassNameCore() => nameof(RepeatButton); | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Button; | ||
|
||
public void Invoke() | ||
{ | ||
bool bIsEnabled = IsEnabled(); | ||
|
||
if (!bIsEnabled) | ||
{ | ||
throw new InvalidOperationException("Button not enabled"); | ||
} | ||
|
||
var owner = (ButtonBase)Owner; | ||
owner.ProgrammaticClick(); | ||
} | ||
} |