Reputation: 165
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?
Upvotes: 1
Views: 798
Reputation: 165
The problem was caused because we missed in the list the following code:
private void ListView_PreviewTouchDown(object sender, System.Windows.Input.TouchEventArgs e)
{
e.Handled = true;
}
Upvotes: 1