0 out of 1 rated this helpful - Rate this topic

ButtonBase::IsPressed Property

Gets a value that indicates whether a ButtonBase is currently activated.

Namespace:  System.Windows.Controls.Primitives
Assembly:  PresentationFramework (in PresentationFramework.dll)
[BrowsableAttribute(false)]
public:
property bool IsPressed {
	bool get ();
	protected: void set (bool value);
}

Property Value

Type: System::Boolean
true if the ButtonBase is activated; otherwise false. The default is false.

Identifier field

IsPressedProperty

Metadata properties set to true

None

IsPressed is the state of a button that indicates the left mouse button or SPACEBAR is pressed over the button. When IsPressed is true, the control captures the mouse. As a result, the control will raise mouse events such as MouseEnter and IsMouseDirectlyOverChanged. Note that using the AccessText or ENTER does not change IsPressed or capture the mouse, but is does raise the Click event.

Starting with the .NET Framework version 3.0 Service Pack 1, IsPressed has a protected setter. To use this functionality, your application should target the .NET Framework version 3.5.  For more information, see .NET Framework Versions and Dependencies.

This example shows how to use the IsPressed property in a trigger style.


<Style x:Key="Triggers" TargetType="Button">
  <Style.Triggers>
    <Trigger Property="IsMouseOver" Value="true">
      <Setter Property = "Background" Value="Red"/>
    </Trigger>
    <Trigger Property="IsPressed" Value="true">
      <Setter Property = "Foreground" Value="Green"/>
    </Trigger>
  </Style.Triggers>
</Style>


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.