0

我正在将此样式应用于infragistics控件XamDateTimeEditor。新的错误图标按预期显示。

问题:发生验证错误时仍显示原始错误样式。从而使控件具有两种错误图标样式。

<Style TargetType="{x:Type XamDateTimeEditor}">
    <Setter Property="Validation.ErrorTemplate">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Control}">
                <DockPanel>
                    <Border 
                        Background="Red" 
                        Width="25" 
                        Height="25" 
                        CornerRadius="10"
                        >
                        <TextBlock 
                            Text="Error" 
                            VerticalAlignment="Center" 
                            HorizontalAlignment="Center" 
                            FontWeight="Bold" 
                            Foreground="White" 
                            />
                    </Border>
                </DockPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
4

1 回答 1

0

IDataErrorInfo自定义目标错误模板时,使用实现的视图模型是最佳方法XamDateTimeEditor

之前在我们的论坛上讨论和演示了这一点:http: //www.infragistics.com/community/forums/t/109152.aspx

https://codeblitz.wordpress.com/2009/05/08/wpf-validation-made-easy-with-idataerrorinfo/

于 2017-03-13T13:44:42.517 回答