Skip to content

Commit

Permalink
chore: Adjust HyperlinkButtonAutomationPeer
Browse files Browse the repository at this point in the history
  • Loading branch information
morning4coffe-dev authored and MartinZikmund committed Jun 17, 2024
1 parent 369c38f commit fc83ec9
Showing 1 changed file with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
// MUX Reference HyperlinkButtonAutomationPeer_Partial.cpp, tag winui3/release/1.4.2

using Microsoft.UI.Composition.Interactions;
using Microsoft.UI.Xaml.Controls;

namespace Microsoft.UI.Xaml.Automation.Peers
namespace Microsoft.UI.Xaml.Automation.Peers;

/// <summary>
/// Exposes HyperlinkButton types to Microsoft UI Automation.
/// </summary>
public partial class HyperlinkButtonAutomationPeer : ButtonBaseAutomationPeer, Provider.IInvokeProvider
{
public partial class HyperlinkButtonAutomationPeer : ButtonBaseAutomationPeer, Provider.IInvokeProvider
public HyperlinkButtonAutomationPeer(HyperlinkButton owner) : base(owner)
{
public HyperlinkButtonAutomationPeer(HyperlinkButton owner) : base(owner)
{
}
}

protected override string GetClassNameCore()
{
return "Hyperlink";
}
protected override string GetClassNameCore() => "Hyperlink";

protected override AutomationControlType GetAutomationControlTypeCore()
{
return AutomationControlType.Hyperlink;
}
protected override AutomationControlType GetAutomationControlTypeCore()
=> AutomationControlType.Hyperlink;

public void Invoke()
public void Invoke()
{
if (!IsEnabled())
{
if (IsEnabled())
{
(Owner as HyperlinkButton).AutomationPeerClick();
}
// UIA_E_ELEMENTNOTENABLED
throw new ElementNotEnabledException();
}

(Owner as HyperlinkButton).AutomationPeerClick();
}
}

0 comments on commit fc83ec9

Please sign in to comment.