0

I can't find how to add in a button style the raise event to click button when there is a touchdown (with touch screen), do you know how to add this in the style? I need to do it because when using touch screen the clickEvent is not fire at first time, generally at second touch (when focus is set to window).

 <Style TargetType="{x:Type Button}">
    <Style.Triggers>
        <EventTrigger RoutedEvent="TouchDown">

How to add the Raise click event??

        </EventTrigger>
    </Style.Triggers>
</Style>

Thank you for your help.

H.B.
  • 166,899
  • 29
  • 327
  • 400
jcq
  • 167
  • 2
  • 13
  • Do you want to **invoke** (cause) it or add a **handler** to an existing event? If you want to cause it - you can't. If you want to add a handler, then this question is a duplicate of this one http://stackoverflow.com/questions/4460201/how-to-set-an-event-function-via-a-style. – Manfred Radlwimmer Jul 18 '16 at 19:33
  • 1
    That makes little sense. When tapping a button you already get a Click event. What exactly are you trying to do here? – Joey Jul 18 '16 at 19:33
  • If you want to do something in a style that will cause Event A to raise Event B, write an attached property that adds an Event A handler, and make the handler raise Event B. Not hard to do, just search SO/Google for a good minimal WPF attached property example. But maybe Joey's got a point; what are you really trying to accomplish, conceptually? – 15ee8f99-57ff-4f92-890c-b56153 Jul 18 '16 at 19:38
  • Thank you for your answer, the touch event is fire each time with a touch screen, but not the click event. Actually we have a lot of controls using the click events, to be sure it fire when we use a touch event i wanted to fire the click event when th touch down is fire (as touch down is done before click). – jcq Jul 19 '16 at 03:26

0 Answers0