title: Implementing both DependencyObject and INotifyPropertyChanged
body: <p>I've got a dependency object that defines a single depedendency property named "Renderer".   </p>
  
  <pre><code>public class Renderer {
    public string ResourceKey{get; set;}
    public string[] Params{get; set;}
  }
  
  public class CellInfo : DependencyObject {
    public static readonly DependencyProperty RendererProperty=
    DependencyProperty.Register("Renderer", typeof(Renderer), typeof(CellInfo), null);
  
    public Renderer Renderer {
      get { return (Renderer)GetValue(RendererProperty); }
      set { SetValue(RendererProperty, value); }
    }
  
    public void UpdateRenderer(string resourceKey, params string[] parameters) {
      this.Renderer.ResourceKey = resourceKey;
      this.Renderer.Params = parameters;
      //force refresh - this does not work
      Renderer tmp = this.Renderer;
      this.Renderer = null;
      this.Renderer = tmp;
    }
  }
  </code></pre>
  
  <p>In XAML I'm declaring it like this:</p>
  
  <pre><code>&lt;local: CellInfo x:key="cellInfo" /&gt;
  </code></pre>
  
  <p>And further down I bind to it as such:</p>
  
  <pre><code> &lt;ControlTemplate x:Key="MyDisplayTemplate" &gt;
      &lt;TextBlock VerticalAlignment="Center" HorizontalAlignment="Stretch"  &gt;
    &lt;TextBlock.Text&gt;
      &lt;MultiBinding Converter="{StaticResource MyConverter}" &gt;
        &lt;Binding Path="Value" /&gt;
        &lt;Binding Source="{StaticResource cellInfo}" Path="Renderer"/&gt;
      &lt;/MultiBinding&gt;
    &lt;/TextBlock.Text&gt;
      &lt;/TextBlock&gt;
  &lt;/ControlTemplate&gt;
  </code></pre>
  
  <p>The above control template is used as the display template for cells of a grid. I want to use dependency objects/properties here for performance reason, given that they do have a performance and memory resource edge over implementing <code>INotifyPropertyChanged</code>
  as I understand it.</p>
  
  <p>The problem I'm having is getting an update to trigger for the cells when data for Renderer object is changed. In code I'm attempting to get around the fact that Dependency properties will not trigger updates if the value is the same by first setting to setting to null, then setting back to the original property value. This does not work.</p>
  
  <p>The only thing I have been able to get to work is to also have the object implement <code>INotifyPropertyChanged</code> and firing the <code>PropertyChanged</code> event in <code>CellInfo.Renderer</code> setter.</p>
  
  <p>My guess is having to implement <code>INotifyPropertyChange</code> negates the performance benefit of using only <code>DependencyObjects</code>, is that correct? At this point, if I'm forced to implement <code>INotifyPropertyChanged</code>, I might as well not even extend <code>DependencyObject</code>, correct?</p>
  
  <p>Thanks for any input.</p>