无法摆脱列表框控件周围的红色验证边框(IDataErrorInfo)

时间:2016-01-04 14:52:42

标签: c# wpf idataerrorinfo

我已从样式属性中删除了红色边框,但它仍然保留在列表框中,我该如何解决这个问题? enter image description here

你可以看到没有红色边框这是默认的东西吗?

<Window.Resources>
        <ControlTemplate x:Key="eTemplate">
            <DockPanel LastChildFill="True">
                <TextBlock DockPanel.Dock="Right" Foreground="Black" FontSize="14" Text="{Binding ElementName=adorned,Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" >
                </TextBlock>
                <Border BorderThickness="0">
                    <AdornedElementPlaceholder x:Name="adorned"/>
                </Border>
            </DockPanel>
        </ControlTemplate>
    </Window.Resources>

<ListBox HorizontalAlignment="Left" Height="73" Margin="449,275,0,0" VerticalAlignment="Top" Width="94" Name="LocationTo" SelectionChanged="listBox_SelectionChanged">
        <ListBox.SelectedIndex>
            <Binding Path="LocationTo" ValidatesOnDataErrors="True" UpdateSourceTrigger="PropertyChanged"/>
        </ListBox.SelectedIndex>
        <ListBoxItem Content="Conn Junction"/>
        <ListBoxItem Content="Multhy Pass"/>
        <ListBoxItem Content="Suddean Halt"/>
        <ListBoxItem Content="End Terminal"/>
    </ListBox>

<TextBox Height="27" Validation.ErrorTemplate="{StaticResource ResourceKey=eTemplate}" HorizontalAlignment="Left" Margin="88,62,0,0" Name="FName" VerticalAlignment="Top" Width="127" FontSize="12" TextChanged="FName_TextChanged">
            <TextBox.Text>
                <Binding Path="FName" ValidatesOnDataErrors="True" UpdateSourceTrigger="PropertyChanged"/>
            </TextBox.Text>
        </TextBox>

0 个答案:

没有答案