title: wpf trigger Datagrid RowCount
body: <p>I have a DataGrid with some columns defined. The rows are bound to an ObservableCollection.
  Next to the Grid is a button which should be visible or not, depending on the number of rows. It should be visible, when there are 2 (or more) rows.
  The idea is to use DataGrid.Rows.Count or DataGrid.Items.Count.</p>
  
  <p>The property "DataGrid.Rows" or "DataGrid.Items" are not known by the compiler. Do you know another way ? I like to have it in Xaml only, and not use a Converter for this. (I know that it could be achieved with a converter that counts the itemcollection) Is there a smarter way ?</p>
  
  <pre><code>&lt;Grid&gt;
  
  &lt;DataGrid Name="dg1"&gt;
      &lt;DataGrid.Columns&gt; 
           ...
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  &lt;Button Name="btn1" Visibility="Visibility"&gt;
  &lt;/Button&gt;
  &lt;Grid.Triggers&gt;
      &lt;Trigger SourceName="dg1" Property="DataGrid.Items.Count" Value="0"&gt;
          &lt;Setter TargetName="btn1" Property="Visibility" Value="Hidden"&gt;&lt;/Setter&gt;
      &lt;/Trigger&gt;
      &lt;Trigger SourceName="dg1" Property="DataGrid.Items.Count" Value="1"&gt;
          &lt;Setter TargetName="btn1" Property="Visibility" Value="Hidden"&gt;&lt;/Setter&gt;
      &lt;/Trigger&gt;
  &lt;/Grid.Triggers&gt;
  </code></pre>
  
  <p></p>