title: ContextMenu bound to ObservableCollection<string> - show item if count == 0
body: <p>I've got an observable collection of strings to thats data bound to my XAML contextmenu:</p>
  
  <p>The ViewModel-Property:</p>
  
  <pre><code>public ObservableCollection&lt;string&gt; Indexes
  {
      get { return _Indexes; }
      private set
      {
          if (value != _Indexes)
          {
              _Indexes = value;
              OnPropertyChanged("Indexes");
          }
      }
  } 
  </code></pre>
  
  <p>The XAML code:</p>
  
  <pre><code>&lt;viewmodel:IndexViewModel x:Key="IndexViewModel" /&gt;
  
  &lt;ContextMenu x:Key="ContextMenu_Index" Placement="Mouse" IsOpen="False"&gt;
      &lt;ContextMenu.ItemsSource&gt;
          &lt;CompositeCollection&gt;
              &lt;MenuItem Header="No items!" IsEnabled="False" Visibility="Collapsed"&gt;
                  &lt;MenuItem.Style&gt;
                      &lt;Style TargetType="{x:Type MenuItem}"&gt;
                          &lt;Style.Triggers&gt;
                              &lt;DataTrigger Binding="{Binding Source={StaticResource IndexViewModel}, Path=Indexes.Count}" Value="0"&gt;
                                  &lt;Setter Property="Visibility" Value="Visible" /&gt;
                              &lt;/DataTrigger&gt;
                          &lt;/Style.Triggers&gt;
                      &lt;/Style&gt;
                  &lt;/MenuItem.Style&gt;
              &lt;/MenuItem&gt;
              &lt;CollectionContainer Collection="{Binding Path=Indexes, Source={StaticResource IndexViewModel}}" /&gt;
          &lt;/CompositeCollection&gt;
      &lt;/ContextMenu.ItemsSource&gt;
      &lt;ContextMenu.Style&gt;
          &lt;Style TargetType="ContextMenu"&gt;&lt;/Style&gt;
      &lt;/ContextMenu.Style&gt;
      &lt;ContextMenu.ItemTemplate&gt;
          &lt;DataTemplate DataType="string"&gt;
              &lt;TextBlock Text="{Binding}" MouseDown="TextBlock_Index_MouseDown"&gt;&lt;/TextBlock&gt;
          &lt;/DataTemplate&gt;
      &lt;/ContextMenu.ItemTemplate&gt;
  &lt;/ContextMenu&gt;
  </code></pre>
  
  <p>Now I want to show the "No items" menu item if the count of Indexes is 0. But unfortunately it doesn't work this way, the "No items!" menu item is not shown. Do you have some hints?</p>