question

RosaTarraga-5765 avatar image
0 Votes"
RosaTarraga-5765 asked HuiLiu-MSFT commented

WPF touch event in screen not working with UserControl



We are developing a WPF application. We use .net4.7 but we have tested it with .net5 and our problem persists.

We have some different elements (buttons, input text...) and sometimes they have to show a "popup" (as a messagebox).

So, our problem happens when we have a list item (listview from windows control) and we want to show a MessageBox; if we do the same thing with a button instead of a list item, it works.

If we manage the MessageBox with the mouse, everything works perfectly, but it we manage with our touch screen, we need to click 10 times to get it working.

This is our list in xml (it comes from a template).

 <lists:VehicleList Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
                                DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:StepSelect}}}"/>

This is what we show through the ViewModel with result yes/no and which buttons we must click 10 times with the touch screen:

 MessageBox.ShowDialog(InfoMessages.driverContinue, MessageBoxButton.YesNo) == MessageBoxResult.Yes) { NavigateForward(this, res);

Any idea?

Thanks in advance :)

PS: We use Windows 10.


Edited:

Found that the problem occurs when I do MessageBox.ShowDialog(whatever); but it does not happen when I do MessageBox.Show(whatever);

Any idea?

dotnet-csharpwindows-wpf
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,@ RosaTarraga-5765. What is your current device about your touch screen, a phone or a MacBook? Is the environment Windows or Macos? Also, it would be better if you could provide more relevant code to reproduce the problem.

0 Votes 0 ·

Hello,

We use our apps in W10 devices with touch screens. Our main problem is that we have one page where we have a list of items, and then we invoke a MessageBox. Both things, page and messagebox are built by us. I had read that this misleads in problems but I did not find the workaround.


Thanks.

0 Votes 0 ·

Hi,@ RosaTarraga-5765. Could you show me the complete UserControl code of your ListView(Including events)? And you can also try to see if the workaround of this link (wpf-listviewitem-events-not-firing-properly-on-touchscreen ) is suitable for your situation.

0 Votes 0 ·
Show more comments
BineeshBabu-8275 avatar image
0 Votes"
BineeshBabu-8275 answered RosaTarraga-5765 commented
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I doubt it since if the stylus detection interfere with touch because the asker did get the touch worked after tapping a few times, instead of not working at all.

0 Votes 0 ·

not working....

0 Votes 0 ·
cheong00 avatar image
0 Votes"
cheong00 answered RosaTarraga-5765 commented

Try follow the advice at the bottom of this issue in Github for WPF.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.