C#コードでsetterプロパティを手動でトリガーしようとしていますが、これが可能かどうかわかりませんか?
C#;
// apply this setter to the control
myControl.FindResource("StandardTextBoxStyle") as Style;
// how can I trigger ErrorTemplateSetter from here!?
私のスタイル;
<Style TargetType="{x:Type TextBox}" x:Key="StandardTextBoxStyle">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Validation.ErrorTemplate" x:Name="ErrorTemplateSetter">
<Setter.Value>
<ControlTemplate>
<DockPanel LastChildFill="true">
<Border Background="OrangeRed" DockPanel.Dock="right" Margin="5,0,0,0"
Width="20" Height="20" CornerRadius="5"
ToolTip="{Binding ElementName=customAdorner,
Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
<TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center"
FontWeight="Bold" Foreground="white" />
</Border>
<AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
<Border BorderBrush="red" BorderThickness="1" />
</AdornedElementPlaceholder>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>