1.错误报警模板

 <!--错新增误验证模板-->
                <Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <StackPanel Orientation="Vertical">
                                <AdornedElementPlaceholder />
                                <TextBlock Foreground="Red"
                                           DockPanel.Dock="Bottom"
                                           VerticalAlignment="Bottom"
                                           FontSize="10"
                                           Margin="0,3,0,0"
                                           Text="{Binding Path=ErrorContent}">
                                </TextBlock>

                            </StackPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="Validation.HasError"
                             Value="True">
                        <Setter Property="BorderBrush"
                                Value="Red" />
                        <Setter Property="BorderThickness"
                                Value="0.5" />
                        <!--报警时,日历时间文本框边框色-->
                        <!--<Setter Property="Background"
                                Value="Red" />-->
                        <!--报警时,日历时间文本字体色-->
                        <!--<Setter Property="Foreground"
                                Value="Red" />-->
                        <!--报警信息浮窗提示-->
                        <!--<Setter Property="ToolTip"
                                Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}">
                            </Setter>-->
                    </Trigger>
                </Style.Triggers>

 

相关文章:

  • 2021-05-20
  • 2022-12-23
  • 2021-08-04
  • 2021-07-21
  • 2021-06-08
  • 2021-04-21
猜你喜欢
  • 2021-10-07
  • 2021-09-05
  • 2021-11-27
  • 2022-02-21
  • 2022-12-23
  • 2022-02-15
  • 2022-01-02
相关资源
相似解决方案