I have DataGrid, initially I create a DataTable with column headers and bind this to DataGrid. when user click on refresh button I will bring data and bind it again.
In the first step, I will create columns in DataTable with no rows and bind that to datagrid to just to display column headers with empty rows.
DataGrid1.DataContext = DataTable1.DefaultView;
DataGrid1.ItemsSource = DataTable1.DefaultView;
when i try to get the columns count here, it comes as zero. As this data changes everytime based on user click, I have to specify column width in code behind.
Can anyone help me how to assign column width from code behind so that we can adjust column spacing for better user view.
View Complete Post