Class GridModelColStylesIndexer
Implements the functionalities that provides access to a grid column styles collection with an indexer.
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridModelColStylesIndexer : GridModelBound, IDisposable, ICollection, IEnumerable
Remarks
Properties
Count
Gets the number of columns in the grid ColCount.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
IsSynchronized
Gets a value indicating whether Is Synchronized. Always false.
Declaration
public bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[Int32]
Gets or sets the column style information of a column.
Declaration
public GridStyleInfo this[int colIndex] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | colIndex |
Property Value
Type |
---|
GridStyleInfo |
Remarks
The indexer provides you with a very simple way to query and change column style contents.
Examples
The following example make some changes to the grid using the indexer:
model.ColStyles[2].Font.Bold = true;
model.ColStyles[2].Font.Size = 16;
model.ColStyles[2].HorizontalAlignment = GridHorizontalAlignment.Center;
model.ColStyles[2].VerticalAlignment = GridVerticalAlignment.Middle;
model.ColStyles[2].CellType = "Static";
model.ColStyles[2].Borders.All = new GridBorder(GridBorderStyle.Solid, Color.FromArgb(100, 238, 122, 3));
model.ColStyles[2].Interior = new BrushInfo(GradientStyle.PathEllipse, Color.FromArgb(100, 57, 73, 122), Color.FromArgb(237, 240, 247));
If you query for specific attributes in a cell and these attributes have not been explicitly set, the GridStyleInfo object that is return by the indexer is smart enough to query base styles for queried information.
model.ColStyles[1].TextColor = Color.FromArgb(0, 21, 84);
Color color = model[1, 1].TextColor;
// model[1, 1].TextColor will return Color.FromArgb(0, 21, 84));
Item[String]
Gets or sets the column style information of a column.
Declaration
public GridStyleInfo this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Property Value
Type |
---|
GridStyleInfo |
SyncRoot
Declaration
public object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Methods
CopyTo(GridStyleInfo[], Int32)
Copies the GridModelColStylesIndexer elements to a one-dimensional System.Array at the specified index.
Declaration
public void CopyTo(GridStyleInfo[] array, int index)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo[] | array | The one-dimensional System.Array that is the destination of the System.Collections.DictionaryEntry objects copied from the GridModelColStylesIndexer instance. The System.Array must have zero-based indexing. |
System.Int32 | index | The zero-based index in |
GetEnumerator()
Returns an System.Collections.IEnumerator that can iterate through the column styles in the GridModelColStylesIndexer instance.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator for the GridModelColStylesIndexer instance. |
Explicit Interface Implementations
ICollection.CopyTo(Array, Int32)
Declaration
void ICollection.CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | |
System.Int32 | index |