ClickMode Enumeration
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Specifies when the Click event should be raised for a control.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
| Member name | Description | |
|---|---|---|
| Release | Specifies that the Click event should be raised when the user lifts their finger from the screen from within the bounds of the control. If you are using the keyboard, specifies that the Click event should be raised when the SPACEBAR or ENTER key is pressed and released, and the control has keyboard focus. | |
| Press | Specifies that the Click event should be raised when the user touches the control. If you are using the keyboard, specifies that the Click event should be raised when the SPACEBAR or ENTER is pressed and the control has keyboard focus. | |
| Hover | Specifies that the Click event should be raised when the user touches the screen outside of the control and then moves over the control. |
The following example demonstrates the ClickMode enumeration.
Hover - When the mouse pointer hovers over the first button, the foreground color of the button changes.
Press - When the left mouse button is pressed while over the second button, the foreground color of the button changes.
Release - When the mouse button is pressed and released while over the third button, the button resets the foreground color of the other two buttons to their original color.
<StackPanel x:Name="LayoutRoot" Background="Transparent" Margin="10">
<Button x:Name="btn1" Margin ="5"
HorizontalAlignment="Left"
Foreground="Green" Width="240" Click="OnClick1"
Content="Hover to Click" ClickMode="Hover" />
<TextBlock x:Name="text1" Margin ="0,8,0,0" />
<Button x:Name="btn2" Margin ="5,5,5,5"
HorizontalAlignment="Left"
Foreground="Blue" Width="240" Click="OnClick2"
Content="Press to Click" ClickMode="Press" />
<TextBlock x:Name="text2" Margin="0,8,0,0" />
<Button x:Name="btn3" Margin ="5,5,5,5"
HorizontalAlignment="Left"
Click="OnClick3" Width="240" Content="Reset"
ClickMode="Release"/>
<TextBlock x:Name="text3" Margin ="0,8,0,0" />
</StackPanel>