title: set ItemContainerStyle from code
body: <p>I am working on a custom wpf control which is derived from a ListBox and am trying to apply some formatting to a custom property.
  When a particular custom property is false, I want to apply some formatting to the ListBox.
  I am using the following code to attempt to apply the styling - </p>
  
  <pre><code>var t = new Trigger();                
  
  var BackgroundSetter = new Setter {Property = BackgroundProperty, Value = null};
  var BrushSetter = new Setter { Property = BorderBrushProperty, Value = null };
  
  t.Setters.Add(BackgroundSetter);
  t.Setters.Add(BrushSetter);
  
  var s = new Style(typeof(ListBox));
  s.Triggers.Add(t);
  
  editor.ItemContainerStyle.Triggers.Add(t);
  </code></pre>
  
  <p>I have also tried the following with no luck - </p>
  
  <pre><code>editor.ItemContainerStyle = s;
  </code></pre>
  
  <p>I am getting an error that indicates that some object was not initialized and stepping through shows that editor.ItemContainerStyle is null.
  The actual error message just says Exception has been thrown by the target of an invocation.</p>
  
  <p>Does anyone have any idea what I might be doing wrong?
  Thanks</p>