Name
DataGridTableStyle
Synopsis
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; } ...
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.