Windows Dev Center

ClickMode enumeration

Specifies when the Click event should be raised for a control.

Syntax


public enum class ClickMode


<object property="enumMemberName"/>

Members

The ClickMode enumeration has these members.

MemberValueDescription
Release0

Specifies that the Click event should be raised when the left mouse button is pressed and released, and the mouse pointer is over 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.

Press1

Specifies that the Click event should be raised when the mouse button is pressed and the mouse pointer is over 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 the control has keyboard focus.

Hover2

Specifies that the Click event should be raised when the mouse pointer moves over the control.

Examples

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" Margin="10">
     <Button x:Name="btn1" Content="Hover to Click"
             Click="OnClick1" ClickMode="Hover"
             Margin="5" Width="150"
             HorizontalAlignment="Left"
             Foreground="Green"/>
     <TextBlock x:Name="text1" Margin="5,8,0,0" />
     
     <Button x:Name="btn2" Content="Press to Click"
             Click="OnClick2" ClickMode="Press"
             Margin="5,5,5,5" Width="150" 
             HorizontalAlignment="Left" 
             Foreground="Blue"/>
     <TextBlock x:Name="text2" Margin="5,8,0,0" />
     
     <Button x:Name="btn3" Content="Reset"
             Click="OnClick3" ClickMode="Release"
             Margin="5,5,5,5" Width="150"
             HorizontalAlignment="Left"/>
     <TextBlock x:Name="text3" Margin="5,8,0,0" />
   </StackPanel>


No code example is currently available or this language may not be supported.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]
[WebHostHidden()]

 

 

Show:
© 2015 Microsoft