I am developing an app which will be used on a laptop with touch screen. Hence MouseDown events are essentially doing the same action, how should this be done.
The code I have written something like this -
XAML
<Button MouseDown="Button_OnMouseDown" TouchDown="Button_OnTouchDown"/>
C#
private void Button_OnMouseDown(object sender, MouseButtonEventArgs e)
{
Action();
}
private void Button_OnTouchDown(object sender, TouchEventArgs e)
{
Action();
}
private void Action()
Is there a better way to do this? Any feedback is appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…