public Window1()
{
InitializeComponent();
this.button1.AddHandler(Control.MouseDownEvent, new MouseButtonEventHandler(openWindow), true);
this.button2.AddHandler(Control.MouseDownEvent, new MouseButtonEventHandler(closeWindow), true);
}
private void openWindow (object sender, RoutedEventArgs e)
{
/* Here some code */
Window1 w1 = new Window1();
I want to launch this application in a PC with a touch screen, then I’m using MouseDown event instead of Click event.
I have realized that when these buttons are pressed, sometimes, they are not changed to Red. I tried to call Dispatcher.Invoke with Render priority once the button is pressed but it didn’t solve the problem.
Re: Buttons not updated when window showed or closed
You mention that you are programming for a touch screen and that you are using the mouse down events. I'm not familiar with programming for a touch screen, so are you saying that Button Click events don't work for touch screens?
Re: Buttons not updated when window showed or closed
Hi Arjay,
You can use Click events in Touch Screen, but I want that the event fires when the user releases the mouse button. If I use Click, it will fire when a mousedown and mouseup event occur on the same element.
Re: Buttons not updated when window showed or closed
I'm confused. Don't you want an event to fire when a button is pressed? Does it matter if a keyboard, mouse click, or touch screen has pressed the button?
Bookmarks