title: Changed SolidColorBrush in TextBox Style
body: <p>I already tried to ask, but probably I did not provide enough information. I am trying to create my own WPF Theme. Everything was ok until I created this style. </p>
  
  <pre><code>    &lt;Style TargetType="{x:Type TextBox}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type TextBox}"&gt;
                  &lt;Grid&gt;
                      &lt;VisualStateManager.VisualStateGroups&gt;
                          &lt;VisualStateGroup x:Name="CommonStates"&gt;
                              &lt;VisualState x:Name="Normal"/&gt;
                              &lt;VisualState x:Name="Disabled"&gt;
                                  &lt;Storyboard&gt;
                                      &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PART_ContentHost"&gt;
                                          &lt;EasingDoubleKeyFrame KeyTime="0" Value="0.5"/&gt;
                                      &lt;/DoubleAnimationUsingKeyFrames&gt;
                                      &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Background"&gt;
                                          &lt;EasingColorKeyFrame KeyTime="0" Value="Red"/&gt;
                                      &lt;/ColorAnimationUsingKeyFrames&gt;
                                      &lt;ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="Background"&gt;
                                          &lt;EasingColorKeyFrame KeyTime="0" Value="Yellow"/&gt;
                                      &lt;/ColorAnimationUsingKeyFrames&gt;
                                  &lt;/Storyboard&gt;
                              &lt;/VisualState&gt;
                              &lt;VisualState x:Name="ReadOnly"/&gt;
                              &lt;VisualState x:Name="MouseOver"/&gt;
                          &lt;/VisualStateGroup&gt;
                      &lt;/VisualStateManager.VisualStateGroups&gt;
                      &lt;Rectangle x:Name="Background" Fill="{StaticResource OniiControlBackgroundBrush}" Stroke="{StaticResource OniiNormalBrush}" RadiusX="2" RadiusY="2"/&gt;
                      &lt;ScrollViewer x:Name="PART_ContentHost" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" FontFamily="{TemplateBinding FontFamily}"/&gt;
                  &lt;/Grid&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property="Foreground" Value="Black"/&gt;
      &lt;Setter Property="SnapsToDevicePixels" Value="True"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>It's supposed to change color of TextBox Background and BorderBrush when TextBox is Disabled.</p>
  
  <p>Colors are defined in same ResourceDictionary </p>
  
  <pre><code>&lt;Color x:Key="MainColor"&gt;#FF595959&lt;/Color&gt;
  &lt;Color x:Key="OniiControlBackgroundColor"&gt;#FF333333&lt;/Color&gt;
  
  &lt;SolidColorBrush x:Key="OniiNormalBrush" Color="{StaticResource MainColor}"/&gt;
  &lt;SolidColorBrush x:Key="OniiControlBackgroundBrush" Color="{StaticResource OniiControlBackgroundColor}" /&gt;
  </code></pre>
  
  <p>And what is really my problem I don't know. What I know: </p>
  
  <p><em>1/ "When TextBox is disabled, it changes the color of everything what uses OniiControlBackgroundBrush To Red Color"</em></p>
  
  <ul>
  <li>OniiControlBackgroundBrush is referenced in other styles as StaticResource</li>
  </ul>
  
  <p><em>2/ "When I switch those colors still only OniiControlBackgroundBrush is changed but this time to Yellow"</em></p>
  
  <pre><code>&lt;Rectangle x:Name="Background" Fill="{StaticResource OniiNormalBrush}" Stroke="{StaticResource OniiControlBackgroundBrush}" RadiusX="2" RadiusY="2"/&gt;
  </code></pre>
  
  <ul>
  <li>OniiNormalBrush is also referenced in other styles as StaticResource</li>
  </ul>
  
  <p><em>3/ "Everything is defined in one resource dictionary"</em></p>
  
  <pre><code>    &lt;Application.Resources&gt;
      &lt;ResourceDictionary Source="Theme/OniiResourceDictionary.xaml"&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p><em>4/ "I tried reproduce this problem in smaller solution with less custom styles and I did not succeeded"</em></p>
  
  <ul>
  <li><p>I used same TextBox style.</p>
  
  <pre><code>&lt;TextBox Height="32" HorizontalAlignment="Left" Margin="38,51,0,0" Name="textBox1" VerticalAlignment="Top" Width="215" /&gt;
  &lt;CheckBox Content="Enabled" Height="16" HorizontalAlignment="Left" Margin="259,51,0,0" Name="checkBox1" VerticalAlignment="Top" Checked="checkBox1_Checked" Unchecked="checkBox1_Unchecked" /&gt;
  &lt;Border Height="148" HorizontalAlignment="Left" Margin="254,126,0,0" Name="border1" VerticalAlignment="Top" Width="98" /&gt;
  &lt;Rectangle Fill="{StaticResource OniiNormalBrush}" StrokeThickness="20" Stroke="{StaticResource OniiControlBackgroundBrush}" Height="148" HorizontalAlignment="Left" Margin="358,126,0,0" Name="rectangle5" VerticalAlignment="Top" Width="99" /&gt;
  </code></pre></li>
  <li><p>Textbox is Disabled and Enabled by CheckBox, Border Uses custom style with both colors as StaticResources</p></li>
  </ul>
  
  <p><em>5/ "When I add following code to my original solution problem disappears"</em></p>
  
  <pre><code>&lt;Rectangle Height="71" HorizontalAlignment="Left" Margin="130,131,0,0" Name="rectangle2" StrokeThickness="20" Stroke="{StaticResource OniiControlBackgroundBrush}" Fill="{StaticResource OniiNormalBrush}" VerticalAlignment="Top" Width="98" /&gt;
  </code></pre>
  
  <p>Am I really missing something? Or Am I just really stupid? Anyway Your help would be appreciated. I am really lost. Well and last thing I don't want to use x:Shared="false" mainly because I see there is no problem with changing OniiNormalBrush. Thank You.</p>