can not hide column

Jan 21, 2012 at 1:35 PM

i need to hide column according to user selection i use 

dataGridProjects.Columns[1].Visibility = Visibility.Collapsed;


after dataGridProjects.FilteredItemsSource = _projectsList;

but it gives me error

Feb 2, 2012 at 4:10 PM

Without posting the error, I'm assuming that the column collection is null.  Even after you set the item source, the columns are only generated after the datagrid is loaded if you are autogenerating your columns.  Try setting your visibility after the grid load.  If this does not work, would you post the error?

Feb 6, 2012 at 7:03 AM

thx for ur replay it work for me after the grid load