can not hide column

Jan 21, 2012 at 12: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

Coordinator
Feb 2, 2012 at 3: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 6:03 AM

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