小编vik*_*kox的帖子

删除组合框周围的红色矩形

我需要删除组合框周围的红色矩形.我在xaml中设置了combobox,如下所示,我试图覆盖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>
Run Code Online (Sandbox Code Playgroud)

用于删除红色矩形的样式,但在xaml中有一些错误,表示Visibility属性无法识别或无法访问.样式定义如下.

<Style x:Key="combostyle">
<Style.Triggers>
    <Trigger Property="Validation.HasError" Value="True">
        <Setter Property="Visibility" TargetName="NotValid" Value="Visible"/>
    </Trigger>  
</Style.Triggers>   
Run Code Online (Sandbox Code Playgroud)

任何的想法?:(

validation wpf xaml combobox styling

30
推荐指数
1
解决办法
2万
查看次数

标签 统计

combobox ×1

styling ×1

validation ×1

wpf ×1

xaml ×1