65.9K
CodeProject is changing. Read more.
Home

Silverlight 5 – ClickCount

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (2 votes)

Apr 14, 2011

CPOL
viewsIcon

13130

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.
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");
}