Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这是WPF触摸问题吗?_Wpf_Touch_Multi Touch - Fatal编程技术网

这是WPF触摸问题吗?

这是WPF触摸问题吗?,wpf,touch,multi-touch,Wpf,Touch,Multi Touch,我在WPF窗口中有一个标签框和一些控件。我正在WPF复选框集属性中抛出一个消息框 当我们触摸标签时,消息框会被抛出,但即使我们在其他区域也会被抛出消息框 此问题仅发生在触摸屏上 请检查下面的代码:[为了简单起见,我进行了重构以便于理解] XAML <CheckBox x:Name="chkbox" Style="{StaticResource CheckBoxStyle1}" Grid.Row="0" HorizontalContentAlignment="Left" Backg

我在WPF窗口中有一个标签框和一些控件。我正在WPF复选框集属性中抛出一个消息框

当我们触摸标签时,消息框会被抛出,但即使我们在其他区域也会被抛出消息框

此问题仅发生在触摸屏上

请检查下面的代码:[为了简单起见,我进行了重构以便于理解]

XAML

<CheckBox x:Name="chkbox"   Style="{StaticResource CheckBoxStyle1}" Grid.Row="0"  HorizontalContentAlignment="Left"   Background="Red"
Content="SampleCheckBox" 
IsChecked="{Binding Path=CheckBoxValue}" Margin="18,4,0,0"></CheckBox>
问题的可能原因

<Style x:Key="CheckBoxStyle1" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="{DynamicResource {x:Static  SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderBrush" Value="BlanchedAlmond"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Padding" Value="2,0,0,0"/>
<Setter Property="ClickMode" Value="Press"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
public class GridViewModel : ViewModelBase1
{
    public bool dummyFlag = true;

    public bool testflag = false;

    public System.Windows.UIElement view;

    public bool CheckBoxValue
    {
        get { return testflag; }
        set
        {
            System.Windows.MessageBox.Show("test", "Title", MessageBoxButton.OK, MessageBoxImage.Information);
            //OnPropertyChanged("CheckBoxValue");
        }
    }
}
  • 在set属性中抛出消息框。如果删除消息框,调试流不会转到set属性

  • 另外,如果我将下面的setter属性配置为Release,则不会出现问题。Setter Property=“ClickMode”Value=“释放”

  • 然而,这并不是这个问题的真正原因

    任何帮助都会很好

    请执行以下操作1)放置制动点。在二传中。2) 打开stacktrace窗口,将其内容复制粘贴到问题中。请执行以下操作1)放置制动点。在二传中。2) 打开stacktrace窗口并将其内容复制粘贴到问题中。