Reputation: 2353
I created a Border on a WPF User Control and signed up for the Touch Down and the Mouse Left Button Down Event.
<Border
TouchDown="Border_TouchDown_1"
MouseLeftButtonDown="Border_MouseLeftButtonDown_1">
<Label FontSize="28">Label</Label>
</Border>
In the code behind file I have following event handlers:
private void Border_TouchDown_1(object sender, TouchEventArgs e)
{
e.Handled = true;
Result.Append("Border_TouchDown_1" + "\n");
LogText = Result.ToString();
RaisePropertyChange();
}
private void Border_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
Result.Append("Border_MouseLeftButtonDown_1" + "\n");
LogText = Result.ToString();
RaisePropertyChange();
}
On a Touch Gesture in windows 8 I see both event handlers getting triggered even if the event is handled in the Border_TouchDown_1 method. In Windows 7 I see only the Border_TouchDown_1 method gets called which seemed to be correct because the event is handled.
I guess Microsoft concisely decided to fire both events to make all Applications Touch aware which is ok for Mouse only application but my application is Touch aware and I would like to switch this behavior off.
Anybody with some insides out there???
Upvotes: 2
Views: 1124
Reputation: 5009
Do you know what will blow your mind? If you DO NOT set e.Handled = true
, you won't get the mouse event (at least for PreviewTouchDown / PreviewMouseDown). It's almost like someone made a typo for windows 8 and it is working backwards.
Upvotes: 2