Monday, July 4, 2011

Converting or Accessing ItemSource as DataTabe from WPF DataGrid




// dataGrid1 of type DataGrid
DataTable dt = ((DataView)dataGrid1.ItemsSource).Table;


Sunday, July 3, 2011

Changing WPF C# DataGrid Column Width




DataGridColumn col = dataGrid1.Columns[0]; // first column
col.Width = 100; // change as per your requirement