Export (0) Print
Expand All
Expand Minimize

ClickMode Enumeration

Specifies when the Click event should be raised.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

'Declaration
Public Enumeration ClickMode
<object property="enumerationMemberName" .../>

Member nameDescription
HoverSpecifies that the Click event should be raised when the mouse hovers over a control.
PressSpecifies that the Click event should be raised as soon as a button is pressed.
ReleaseSpecifies that the Click event should be raised when a button is pressed and released.

The following example shows three buttons that respond to clicks in three different ways.

  • Hover - the first button changes colors when the user hovers with the mouse over the button.

  • Press - the second button requires that the mouse be pressed while the mouse pointer is in the button.

  • Release - the third button does not reset the background color of the buttons until the mouse is pressed and released in the button.

<Button Name="btn1" Background="Pink" 
        BorderBrush="Black" BorderThickness="1" 
        Click="OnClick1" ClickMode="Hover">
  ClickMe1
</Button>

<Button Name="btn2" Background="LightBlue" 
        BorderBrush="Black" BorderThickness="1" 
        Click="OnClick2" ClickMode="Press">
  ClickMe2
</Button>

<Button Name="btn3" 
        Click="OnClick3" ClickMode="Release">
  Reset
</Button>
Private Sub OnClick1(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn1.Background = Brushes.LightBlue
End Sub 

Private Sub OnClick2(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn2.Background = Brushes.Pink
End Sub 

Private Sub OnClick3(ByVal sender As Object, ByVal e As RoutedEventArgs)
    btn1.Background = Brushes.Pink
    btn2.Background = Brushes.LightBlue
End Sub

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft