Click here to Skip to main content
15,887,676 members
Articles / Silverlight
Tip/Trick

Silverlight 5 – ClickCount

Rate me:
Please Sign up or sign in to vote.
3.00/5 (2 votes)
14 Apr 2011CPOL 12.9K   2   1
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)


Written By
Software Developer (Senior) Telerik
United States United States
Michael Crump is a Silverlight MVP and MCPD that has been involved with computers in one way or another for as long as he can remember, but started professionally in 2002. After spending years working as a systems administrator/tech support analyst, Michael branched out and started developing internal utilities that automated repetitive tasks and freed up full-time employees. From there, he was offered a job working at McKesson corporation and has been working with some form of .NET and VB/C# since 2003.

He has worked at Fortune 500 companies where he gained experience in embedded systems design and software development to systems administration and database programming, and everything in between.

His primary focus right now is developing healthcare software solutions using Microsoft .NET technologies. He prefers building infrastructure components, reusable shared libraries and helping companies define, develop and automate process standards and guidelines.

You can read his blog at: MichaelCrump.net or follow him on Twitter at @mbcrump.

Comments and Discussions

 
QuestionDataGridTextColumn Pin
Mycroft Holmes18-May-12 22:51
professionalMycroft Holmes18-May-12 22:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.