Q:

Check Value Before Showing In Datagrid

I have a model like this:
   public class product
    {
       public int id;
       public string name;
       public bool show;
    }

Also I have a list with this model:
 List<product> list;

bind:
dataGrid.ItemsSource = list;

Each item of 'list' that have this condition: 
if (product.show == false)

shouldn't display in Datagrid. 
Please Help Me.
Thanks

A:

try this:
List<product> sortedList = list.Where(item => item.show != false).ToList();
dataGrid.ItemsSource =sortedList;

