title: Radio Button Error Style
body: <p>I have implemented an error style for textboxes using the following code.  This sets a tool tip and puts a nice error image to the right of the textbox if the element reports an error status via an IDataErrorInfo interface:</p>
  
  <pre><code>    &lt;!-- Set error style for textboxes --&gt;
      &lt;Style x:Key="txtBoxErrStyle" TargetType="{x:Type TextBox}"&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="Validation.HasError" Value="True"&gt;
                  &lt;Setter Property="ToolTip" 
                          Value="{Binding RelativeSource={x:Static RelativeSource.Self}, 
                          Path=(Validation.Errors)[0].ErrorContent}" /&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
  
          &lt;Setter Property="Validation.ErrorTemplate"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate&gt;
                      &lt;DockPanel DockPanel.Dock="Right"&gt;
                          &lt;AdornedElementPlaceholder /&gt;
                          &lt;Image Source="Icons/Error.png"
                                 Height="16"
                                 Width="16"
                                 ToolTip="{Binding Path=AdornedElement.ToolTip, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Adorner}}}" /&gt;
                      &lt;/DockPanel&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>This works really well for me by adding the tool tip text and setting the Error.png image to the right of the textbox.  But what I want to do is give similar functionality to a radio button.  I attempted to do this by copying the above code and changing the  tag to be:</p>
  
  <pre><code>    &lt;!-- Set error style for radio buttons --&gt;
      &lt;Style x:Key="radioBtnErrStyle" TargetType="{x:Type RadioButton}"&gt;
  </code></pre>
  
  <p>The field that the radio button is bound to reports errors via the IDataErrorInfo interface, and the radio button itself has ValidatesOnDataErrors set to true.</p>
  
  <p>This <strong>sort of</strong> worked for me.  When the radio button is deemed to be in error, the tool tip <strong>is</strong> set to the error message returned from the IDataErrorInfo routine.  But I cannot seem to get the Error.png image to display on the form.</p>
  
  <p>I have tried some basic screwing around with the style, such as swapping the order of the  and  elements, but nothing I tried seemed to work.</p>
  
  <p>So any ideas as to how I can get the image to display? </p>
  
  <p><strong>Update</strong></p>
  
  <p>Steffen's reply hit the nail on the head.  Increasing the margin did allow room for the image to be displayed.  </p>
  
  <p>However I have run into another, separate issue in that if the error  condition is present when the program first starts then the tool tip will reflect the error condition, but the image will not be displayed.  It is only when error condition is actively raised after the program start does the image also be displayed.  I have seen this before but have not yet seen the correct way of handling it. Time to research another WPF topic!</p>