I have a minor problem with the Textbox Style below - with the Validation.ErrorTemplate to be precise. I want the error image that's displayed to the right of the textbox, be really located right of the textbox (which has to shrink horizontally for that) and not within like it is now. Any suggestions?
<Style TargetType="{x:Type TextBox}">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<Grid MaxWidth="{Binding Path=AdornedElement.ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Adorner}}}">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<AdornedElementPlaceholder />
<Image Grid.Column="1" Source="Images/error.png" Width="20" Height="20" Margin="0, 0, 0, 0" ToolTip="{Binding Path=AdornedElement.ToolTip, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Adorner}}}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>