private void createGridColumns(MSDataGrid msDataGrid) { try { //DataGridColumn dgtc = (DataGridColumn)msDataGrid.Columns[4]; //MessageBox.Show(dgtc.Width.DisplayValue.ToString()); int columnsCount = msDataGrid.Columns.Count; dicColumnDefinitions = new Dictionary <int, ColumnDefinition>(); grid_footerRow.Children.Clear(); grid_footerRow.ColumnDefinitions.Clear(); double width = 0; for (int i = 0; i < columnsCount; i++) { ColumnDefinition cd = new ColumnDefinition(); //if(msDataGrid.Columns[i].Visibility == System.Windows.Visibility.Visible) { cd.Width = new GridLength(Convert.ToDouble(((DataGridColumn)msDataGrid.Columns[i]).Width.DisplayValue), GridUnitType.Star); //} width += Convert.ToDouble(((DataGridColumn)msDataGrid.Columns[i]).Width.DisplayValue); dicColumnDefinitions.Add(i, cd); grid_footerRow.ColumnDefinitions.Add(cd); } grid_footerRow.Width = width; } catch (Exception) { } }
public void dataContextBinded(MSDataGrid msDataGrid) { try { this.msDataGrid = msDataGrid; if (msDataGrid.TotalColumnIndexes != null) { dispatcherTimer.Start(); } } catch (Exception) { } }