title: WPF ContextMenu bind some property to another property of the same control
body: <p>I have a ContextMenu and a ColumnHeaderStyle defined in Window.Resource section which I use-it to a DataGrid ColumnHeader. My code is something like this:</p>
  
  <pre><code>&lt;ContextMenu x:Key="cm_columnHeaderMenu"/&gt;
  
  &lt;Style x:Key="DefaultColumnHeaderStyle" TargetType="{x:Type DataGridColumnHeader}"&gt;
      &lt;Setter Property="ContextMenu" Value="{StaticResource cm_columnHeaderMenu}" /&gt;
  &lt;/Style&gt;
  
  &lt;DataGrid Grid.Column="2" Grid.Row="1" x:Name="dgridFiles" IsReadOnly="True" 
   ColumnHeaderStyle="{StaticResource DefaultColumnHeaderStyle}"&gt;
  </code></pre>
  
  <p>I want to know if I can (and if the answer it true, then HOW I can I do it) bind the ContextMenu Visibility property to same control ContextMenu Items.Count > 0 property.</p>
  
  <p>Initially based on some other treeView control selections made there shoud be no items in the context menu, but i wish to add dinamically items in ContextMenu based on selection in treeView. This part is done, the context has those items. On some selections there are no-items, but still on the grid it appears an empty ContextMenu. So I believe the easiest part it would be to bind the Visibility to Items.Count property of the same control.</p>
  
  <p>Sorry if my english is not good enough, I'll try to explain better if i didnt make clear 1st time.</p>