title: Cannot animate (0).(1) on an immutable object?
body: <p>I have a ComboBox with a custom theme I wrote, and I get the error message "Cannot animate (0).(1) on an immutable object." This specifically happens when I set its <code>selectedindex</code> after the user selects one of the options in the combobox.</p>
  
  <p>Doing some research online, I found that this is a common issue with databound items or dynamic resources. I'm not using any databound resources, but what I think is happening is since the combobox is collapsed, it tries to set the state of a button that doesn't exist. I narrowed it down to this code:</p>
  
  <pre><code>&lt;ControlTemplate.Triggers&gt;
    &lt;Trigger Property="IsSelected" Value="True"&gt;
       &lt;Setter TargetName="Border" Property="Background" Value="{DynamicResource spPressedStateBrush}" /&gt;
    &lt;/Trigger&gt;
    &lt;Trigger Property="IsMouseOver" Value="True"&gt;
       &lt;Setter TargetName="Border" Property="Background" Value="{DynamicResource spOverStateBrush}" /&gt;
    &lt;/Trigger&gt;
  &lt;/ControlTemplate.Triggers&gt;
  </code></pre>
  
  <p>Which depends on these Dynamic Resources:</p>
  
  <pre><code>&lt;LinearGradientBrush x:Key="spOverStateBrush" StartPoint="0,0" EndPoint="0,1"&gt;
      &lt;GradientStop Color="#2C8CBF" Offset="0" /&gt;
      &lt;GradientStop Color="#2793BF" Offset="0.5" /&gt;
      &lt;GradientStop Color="#2483BF" Offset="0.5001" /&gt;
      &lt;GradientStop Color="#2C8CBF" Offset="1" /&gt;
  &lt;/LinearGradientBrush&gt;
  
  &lt;LinearGradientBrush x:Key="spPressedStateBrush" StartPoint="0,0" EndPoint="0,1"&gt;
      &lt;GradientStop Color="#0C6C9F" Offset="0" /&gt;
      &lt;GradientStop Color="#07739F" Offset="0.5" /&gt;
      &lt;GradientStop Color="#04639F" Offset="0.5001" /&gt;
      &lt;GradientStop Color="#0C6C9F" Offset="1" /&gt;
  &lt;/LinearGradientBrush&gt;
  </code></pre>
  
  <p>So I'm pretty sure those dynamic resources are the culprit, but how would I solve this problem?</p>