title: WPF XAML - Adding multiple styles to resource dictionary which target rowdefinition
body: <p>Thanks for your thoughts in helping a relative beginner understand WPF.</p>
  <p>I am trying to use the following style template in an XAML file for a WPF application:</p>
  <pre><code>&lt;Window.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;ResourceDictionary&gt;
                      &lt;Style TargetType=&quot;{x:Type RowDefinition}&quot;
                          x:Key=&quot;hideIfNotDischarged&quot;&gt;
                          &lt;Style.Triggers&gt;
                              &lt;DataTrigger Binding=&quot;{Binding DischargedBy28Days,
                                  Mode=OneWay}&quot; Value=&quot;false&quot;&gt;
                                  &lt;Setter Property=&quot;Height&quot; Value=&quot;0&quot; /&gt;
                              &lt;/DataTrigger&gt;
                          &lt;/Style.Triggers&gt;
                      &lt;/Style&gt;
                      &lt;Style TargetType=&quot;{x:Type RowDefinition}&quot;
                          x:Key=&quot;hideIfOutcomeKnownAndAlive&quot;&gt;
                          &lt;Style.Triggers&gt;
                              &lt;DataTrigger Binding=&quot;{Binding IsKnownDead,
                                  Mode=OneWay}&quot; Value=&quot;false&quot;&gt;
                                  &lt;Setter Property=&quot;Height&quot; Value=&quot;0&quot; /&gt;
                              &lt;/DataTrigger&gt;
                          &lt;/Style.Triggers&gt;
                      &lt;/Style&gt;
                  &lt;/ResourceDictionary&gt;
          &lt;/ResourceDictionary.MergedDictionaries&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  <p>Which will be later used in a grid like so:</p>
  <pre><code>&lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height=&quot;Auto&quot; /&gt;
          &lt;RowDefinition Height=&quot;30&quot; /&gt;
          &lt;RowDefinition Style=&quot;{StaticResource hideIfNotDischarged}&quot; /&gt;
          ...
  </code></pre>
  <p>However, if there is more than 1 style element targeting Type <code>RowDefinition</code> AND ALSO the <code>ResourceDictionary</code> is nested within a <code>MergedDictionary</code> (even with only a single child <code>ResourceDictionary</code> to merge) the application fails with
  <code>System.Windows.ResourceDictionary.DeferrableContent</code>: Item has already been added.</p>
  <p>That is, despite the fact the 2 styles have different keys, the resource dictionary is trying to add a dictionary item with name based purely on the target type (and ignoring the key).</p>
  <p>Any help with how I might overcome this would be most appreciated.</p>