Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Silverlight

Silverlight 5 – ClickCount

3.00/5 (2 votes)
14 Apr 2011CPOL 13.1K  
Silverlight 5 enables support for multi-click input on left and right mouse button
Silverlight 5 enables support for multi-click input on left and right mouse button making it easier to implement features like double click. ClickCount is available on MouseButtonEventArgs.

Drag a rectangle or button on the MainPage.xaml for example and wire up the following Event Handler.

C#
private void ClickMe_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    if (e.ClickCount == 1)
        System.Diagnostics.Debug.WriteLine("Single Click");

    if (e.ClickCount == 2)
        System.Diagnostics.Debug.WriteLine("Double Click");

    if (e.ClickCount >= 3)
        System.Diagnostics.Debug.WriteLine("Triple Click");
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)