title: Set Style Setter value from code-behind at runtime
body: <p>In silverlight, there is a known textbox caret bug that is discussed here: <a href="http://forums.silverlight.net/p/165276/423268.aspx" rel="nofollow">http://forums.silverlight.net/p/165276/423268.aspx</a></p>
  
  <p>As a workaround, an attached behaviour is used that allows to specify the color for TextBox caret explicitly.</p>
  
  <p>Therefore I have the following setter in my TextBox style:</p>
  
  <pre><code>&lt;Style x:Key="NameEditStyle" TargetType="TextBox"&gt;
              &lt;Setter Property="Utilities:FixCaretBrushBehavior.CaretBrush" Value="White" /&gt;
  </code></pre>
  
  <p>My application is running on Windows Phone, where there can be both White and Black backgrounds for the TextBoxes. I need to conditionally modify whether the caret will appear White to Black. (which is equivalent to setting a <code>Value</code> of the property).</p>
  
  <p>How can I conditionally change this particular property in a style setter from code?</p>
  
  <p>I have tried giving a property an x:Name and trying to reference it in code-behind, but the property is always <code>null</code>, so I can't adjust it's value.  </p>