// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Automation.Peers; using System.Windows.Controls; namespace Microsoft.Management.UI.Internal { /// /// Provides a control that is always visible in the automation tree. /// [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] [Description("Provides a System.Windows.Controls.Button control that is always visible in the automation tree.")] public class AutomationButton : Button { #region Constructors /// /// Initializes a new instance of the class. /// public AutomationButton() { // This constructor intentionally left blank } #endregion #region Overides /// /// Returns the implementations for this control. /// /// The implementations for this control. protected override AutomationPeer OnCreateAutomationPeer() { return new AutomationButtonAutomationPeer(this); } #endregion } /// /// Provides an automation peer for AutomationButton. /// [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] internal class AutomationButtonAutomationPeer : ButtonAutomationPeer { #region Constructors /// /// Initializes a new instance of the class. /// /// The owner of the automation peer. public AutomationButtonAutomationPeer(Button owner) : base(owner) { // This constructor intentionally left blank } #endregion #region Overrides /// /// Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. Called by IsControlElement(). /// /// This method always returns false. protected override bool IsControlElementCore() { return this.Owner.Visibility != Visibility.Hidden; } #endregion } }