title: Wpf DataGrid hide rows when checkbox is true and bound data is true
body: <p>I want to disable visibility(collapse) of certain rows when a checkbox is checked and the bound data that is on that row matches certain criteria. for example(pseudo code):</p>
  
  <pre><code>    If(IsHideEnabledChecked &amp;&amp; Row.Data.Enabled)
         Row.Visibility = Collapsed
  </code></pre>
  
  <p>I have created the datagrid(s) pro-grammatically due to the nature of the project i am working on, the number of datagrids need to match the number of objects in my collection. Normally in a non wpf world you would loop through the grids and change the row on condition:</p>
  
  <pre><code>public void HideEnabled(object sender, RoutedEventArgs)
     Foreach(DataGrid grid in DataGrids)
     {
       Foreach(DataGridRow row in grid)
       {
         if(row[0].Value == True)
             row.Visibile = false
       }
     }
  </code></pre>
  
  <p>My question is, how do i hide the rows after the checkbox is selected? and how would this be checked against the values on the current row? Can this all be done in c#? I have looked around and can see that dataTriggers can be used to bind a control to a column and datatype but that would not include checking against the bound data(the property "enabled")</p>
  
  <p>Any help would be much appreciated :)</p>