public DataGridTableStyle(CurrencyManager listManager) : this() { this.mappingName = listManager.GetListName(); this.SetGridColumnStylesCollection(listManager); }
public DataGridTableStyle(CurrencyManager listManager) : this() { Debug.Assert(listManager != null, "the DataGridTabel cannot use a null listManager"); this.mappingName = listManager.GetListName(); // set up the Relations and the columns SetGridColumnStylesCollection(listManager); }
private void PairTableStylesAndGridColumns(CurrencyManager lm, DataGridTableStyle gridTable, bool forceColumnCreation) { PropertyDescriptorCollection itemProperties = lm.GetItemProperties(); GridColumnStylesCollection gridColumnStyles = gridTable.GridColumnStyles; if (!gridTable.IsDefault && (string.Compare(lm.GetListName(), gridTable.MappingName, true, CultureInfo.InvariantCulture) == 0)) { if ((gridTable.GridColumnStyles.Count == 0) && !base.DesignMode) { if (forceColumnCreation) { gridTable.SetGridColumnStylesCollection(lm); } else { gridTable.SetRelationsList(lm); } } else { for (int i = 0; i < gridColumnStyles.Count; i++) { gridColumnStyles[i].PropertyDescriptor = null; } for (int j = 0; j < itemProperties.Count; j++) { DataGridColumnStyle style = gridColumnStyles.MapColumnStyleToPropertyName(itemProperties[j].Name); if (style != null) { style.PropertyDescriptor = itemProperties[j]; } } gridTable.SetRelationsList(lm); } } else { gridTable.SetGridColumnStylesCollection(lm); if ((gridTable.GridColumnStyles.Count > 0) && (gridTable.GridColumnStyles[0].Width == -1)) { this.InitializeColumnWidths(); } } }