这是WPF触摸问题吗?
我在WPF窗口中有一个标签框和一些控件。我正在WPF复选框集属性中抛出一个消息框 当我们触摸标签时,消息框会被抛出,但即使我们在其他区域也会被抛出消息框 此问题仅发生在触摸屏上 请检查下面的代码:[为了简单起见,我进行了重构以便于理解] XAML这是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
<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");
}
}
}