DataGridTableStyle | marshal by reference, disposable |
System.Windows.Forms (system.windows.forms.dll) | class |
This class is used to customize the binding and appearance of a
DataGrid. While the default implementation will
automatically create appropriate tables and columns for your data
source, you can take more control by adding this information by hand.
You do this through the DataGrid.TableStyles
property. For each table in your data source that you want to display
in the grid, you create a DataGridTableStyle
object. First, you can set the data table to which this object is
bound through the MappingName property. You can
then independently control the colors, grid lines, widths, and
heights for which you set defaults in the parent grid, before adding
DataGridColumnStyle objects to the
GridColumnStyles collection that represent each
column in that table.
public class DataGridTableStyle : System.ComponentModel.Component : IDataGridEditingService {
// Public Constructors
public DataGridTableStyle();
public DataGridTableStyle(bool isDefaultTableStyle);
public DataGridTableStyle(CurrencyManager listManager);
// Public Static Fields
public static DataGridTableStyle DefaultTableStyle; // =System.Windows.Forms.DataGridTableStyle
// Public Instance Properties
public bool AllowSorting{set; get; }
public Color AlternatingBackColor{set; get; }
public Color BackColor{set; get; }
public bool ColumnHeadersVisible{set; get; }
public virtual DataGrid DataGrid{set; get; }
public Color ForeColor{set; get; }
public virtual GridColumnStylesCollection GridColumnStyles{get; }
public Color GridLineColor{set; get; }
public DataGridLineStyle GridLineStyle{set; get; }
public Color HeaderBackColor{set; get; }
public Font HeaderFont{set; get; }
public Color HeaderForeColor{set; get; }
public Color LinkColor{set; get; }
public Color LinkHoverColor{set; get; }
public string MappingName{set; get; }
public int PreferredColumnWidth{set; get; }
public int PreferredRowHeight{set; get; }
public virtual bool ReadOnly{set; get; }
public bool RowHeadersVisible{set; get; }
public int RowHeaderWidth{set; get; }
public Color SelectionBackColor{set; get; }
public Color SelectionForeColor{set; get; }
// Public Instance Methods
public bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber); // implements IDataGridEditingService
public bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber,
bool shouldAbort); // implements IDataGridEditingService
public void ResetAlternatingBackColor();
public void ResetBackColor();
public void ResetForeColor();
public void ResetGridLineColor();
public void ResetHeaderBackColor();
public void ResetHeaderFont();
public void ResetHeaderForeColor();
public void ResetLinkColor();
public void ResetLinkHoverColor();
public void ResetSelectionBackColor();
public void ResetSelectionForeColor();
// Protected Instance Methods
protected internal virtual DataGridColumnStyle CreateGridColumn(System.ComponentModel.PropertyDescriptor prop);
protected internal virtual DataGridColumnStyle CreateGridColumn(System.ComponentModel.PropertyDescriptor prop,
bool isDefault);
protected override void Dispose(bool disposing); // overrides System.ComponentModel.Component
protected virtual void OnAllowSortingChanged(EventArgs e);
protected virtual void OnAlternatingBackColorChanged(EventArgs e);
protected virtual void OnBackColorChanged(EventArgs e);
protected virtual void OnColumnHeadersVisibleChanged(EventArgs e);
protected virtual void OnForeColorChanged(EventArgs e);
protected virtual void OnGridLineColorChanged(EventArgs e);
protected virtual void OnGridLineStyleChanged(EventArgs e);
protected virtual void OnHeaderBackColorChanged(EventArgs e);
protected virtual void OnHeaderFontChanged(EventArgs e);
protected virtual void OnHeaderForeColorChanged(EventArgs e);
protected virtual void OnLinkColorChanged(EventArgs e);
protected virtual void OnLinkHoverColorChanged(EventArgs e);
protected virtual void OnMappingNameChanged(EventArgs e);
protected virtual void OnPreferredColumnWidthChanged(EventArgs e);
protected virtual void OnPreferredRowHeightChanged(EventArgs e);
protected virtual void OnReadOnlyChanged(EventArgs e);
protected virtual void OnRowHeadersVisibleChanged(EventArgs e);
protected virtual void OnRowHeaderWidthChanged(EventArgs e);
protected virtual void OnSelectionBackColorChanged(EventArgs e);
protected virtual void OnSelectionForeColorChanged(EventArgs e);
protected virtual bool ShouldSerializeAlternatingBackColor();
protected bool ShouldSerializeBackColor();
protected bool ShouldSerializeForeColor();
protected virtual bool ShouldSerializeGridLineColor();
protected virtual bool ShouldSerializeHeaderBackColor();
protected virtual bool ShouldSerializeHeaderForeColor();
protected virtual bool ShouldSerializeLinkColor();
protected virtual bool ShouldSerializeLinkHoverColor();
protected bool ShouldSerializePreferredRowHeight();
protected bool ShouldSerializeSelectionBackColor();
protected virtual bool ShouldSerializeSelectionForeColor();
// Events
public event EventHandler AllowSortingChanged;
public event EventHandler AlternatingBackColorChanged;
public event EventHandler BackColorChanged;
public event EventHandler ColumnHeadersVisibleChanged;
public event EventHandler ForeColorChanged;
public event EventHandler GridLineColorChanged;
public event EventHandler GridLineStyleChanged;
public event EventHandler HeaderBackColorChanged;
public event EventHandler HeaderFontChanged;
public event EventHandler HeaderForeColorChanged;
public event EventHandler LinkColorChanged;
public event EventHandler LinkHoverColorChanged;
public event EventHandler MappingNameChanged;
public event EventHandler PreferredColumnWidthChanged;
public event EventHandler PreferredRowHeightChanged;
public event EventHandler ReadOnlyChanged;
public event EventHandler RowHeadersVisibleChanged;
public event EventHandler RowHeaderWidthChanged;
public event EventHandler SelectionBackColorChanged;
public event EventHandler SelectionForeColorChanged;
}
Hierarchy
System.Object
System.MarshalByRefObject
System.ComponentModel.Component(System.ComponentModel.IComponen,
System.IDisposable)
DataGridTableStyle(IDataGridEditingService)
Returned By
DataGridColumnStyle.DataGridTableStyle,
GridTablesFactory.CreateGridTables(),
GridTableStylesCollection.this
Passed To
GridTablesFactory.CreateGridTables(),
GridTableStylesCollection.{Add(),
AddRange( ), Contains(),
Remove()}
|