ClickMode Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

public enum ClickMode

Members

Member name Description
Supported by Silverlight for Windows Phone Release 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.
Supported by Silverlight for Windows Phone Press 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 is pressed and the control has keyboard focus.
Supported by Silverlight for Windows Phone Hover 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.

void OnClick1(object sender, RoutedEventArgs e)
{
    btn1.Foreground = new SolidColorBrush(Colors.Blue);
    text1.Text = "Click event handled on Hover.";
    text2.Text = "";
    text3.Text = "";
}

void OnClick2(object sender, RoutedEventArgs e)
{
    btn2.Foreground = new SolidColorBrush(Colors.Green);
    text1.Text = "";
    text2.Text = "Click event handled on Press.";
    text3.Text = "";
}

void OnClick3(object sender, RoutedEventArgs e)
{
    btn1.Foreground = new SolidColorBrush(Colors.Green);
    btn2.Foreground = new SolidColorBrush(Colors.Blue);
    text1.Text = "";
    text2.Text = "";
    text3.Text = "Click event handled on Release.";
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.