<textblock x:name="tb" text="" background="Black" foreground="White" />
public partial class Window1 : Window { public Window1() { InitializeComponent(); this.tb.MouseDown += new MouseButtonEventHandler(tb_MouseDown); } void tb_MouseDown(object sender, MouseButtonEventArgs e) { // Checks the number of clicks. if (e.ClickCount == 1) { // Single Click occurred. this.tb.Text = "Single Click"; DoSomethingForClick(); } if (e.ClickCount == 2) { // Double Click occurred. this.tb.Text += "Double Click"; DoAnotherForDoubleClick(); } if (e.ClickCount >= 3) { // Triple Click occurred. this.tb.Text += "Triple Click"; } } }
DoSomethingForClick()
DoAnotherForDoubleClick()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)