【发布时间】:2011-05-07 08:42:58
【问题描述】:
我需要删除组合框周围的红色矩形。我在 xaml 中设置了组合框,如下所示,我正在尝试覆盖 Validation.ErrorTemplate。
<ComboBox x:Name="comboPodkategoria"
Margin="0,3,0,0"
IsSynchronizedWithCurrentItem="False"
IsEditable="False"
ItemsSource="{Binding Source={StaticResource PodKategoriaLookup}, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
SelectedValue="{Binding IDPodKategoria}"
DisplayMemberPath="kat_popis" SelectedValuePath="IDPodkat" TabIndex="5" Style="{StaticResource combostyle}">
<Validation.ErrorTemplate>
<ControlTemplate>
</ControlTemplate>
</Validation.ErrorTemplate>
</ComboBox>
还有用于删除红色矩形的样式,但 xaml 中有一些错误,表示无法识别或无法访问 Visibility 属性。样式定义如下。
<Style x:Key="combostyle">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="Visibility" TargetName="NotValid" Value="Visible"/>
</Trigger>
</Style.Triggers>
有什么想法吗? :(
【问题讨论】:
标签: wpf validation xaml combobox styling