Class GridCellModelCollection
Represents a collection of GridCellModelBase objects in the GridModel.
Implements
Namespace: Syncfusion.Windows.Controls.Grid
Assembly: Syncfusion.Grid.Wpf.dll
Syntax
public class GridCellModelCollection : Disposable, IDisposable, ICollection, IEnumerable, ISerializable, ICloneable
Remarks
On the GridModel, you access the GridCellModelCollection through the CellModels property.
The GridCellModelCollection uses standard Add(String, GridCellModelBase) and Remove(String) methods to manipulate the collection. Use the Contains method to determine if a specific cell type exists in the collection.
Examples
The following example registers a checkbox celltype into the cell models collection.
GridControl grid = new GridControl();
grid.Model.CellModels.Add("CheckBox", new GridCellCheckboxModel());
Constructors
GridCellModelCollection(GridModel)
Initializes an empty GridCellModelCollection and associates it with a GridModel.
Declaration
public GridCellModelCollection(GridModel model)
Parameters
Type | Name | Description |
---|---|---|
GridModel | model | The GridModel that owns this collection of cell types. |
GridCellModelCollection(SerializationInfo, StreamingContext)
Initializes a new GridCellModelCollection from a serialization stream.
Declaration
protected GridCellModelCollection(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | An object that holds all the data needed to serialize or deserialize this instance. |
System.Runtime.Serialization.StreamingContext | context | Describes the source and destination of the serialized stream specified by info. |
Properties
Count
Gets the number of cellTypeName-and-value pairs in the GridCellModelCollection.
Declaration
public virtual int Count { get; }
Property Value
Type |
---|
System.Int32 |
DefaultCellType
The default cell type to be used for cells where a specific cell type could not be loaded.
Declaration
public string DefaultCellType { get; set; }
Property Value
Type |
---|
System.String |
GridModel
Returns the grid model.
Declaration
public GridModel GridModel { get; }
Property Value
Type |
---|
GridModel |
IsSynchronized
Gets a value that indicates whether access to the GridCellModelCollection is synchronized (thread-safe).
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[String]
The GridCellModelBase for the specific cell type name.
Declaration
public virtual GridCellModelBase this[string cellTypeName] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | cellTypeName |
Property Value
Type |
---|
GridCellModelBase |
Keys
Gets a collection of cellTypeNames in the GridCellModelCollection.
Declaration
public virtual ICollection Keys { get; }
Property Value
Type |
---|
System.Collections.ICollection |
SyncRoot
Gets an object that can be used to synchronize access to the GridCellModelCollection.
Declaration
public virtual object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Values
Gets a collection of values in the GridCellModelCollection.
Declaration
public virtual ICollection Values { get; }
Property Value
Type |
---|
System.Collections.ICollection |
Methods
Add(String, GridCellModelBase)
Adds cell model with the specified cellTypeName into the GridCellModelCollection.
Declaration
public virtual void Add(string cellTypeName, GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
System.String | cellTypeName | The cellTypeName of the entry to add. |
GridCellModelBase | cellModel |
Clear()
Removes all entries from the GridCellModelCollection.
Declaration
public virtual void Clear()
Clone()
Creates a copy of this object using System.Object.MemberwiseClone().
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | An exact copy of this object. |
ContainsKey(String)
Determines if the GridCellModelCollection contains a specific cellTypeName.
Declaration
public virtual bool ContainsKey(string cellTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | cellTypeName | The cellTypeName to locate in the GridCellModelCollection. |
Returns
Type | Description |
---|---|
System.Boolean | true if the GridCellModelCollection contains an entry with the specified cellTypeName; otherwise, false. |
ContainsValue(GridCellModelBase)
Determines if the GridCellModelCollection contains a specific value.
Declaration
public virtual bool ContainsValue(GridCellModelBase cellModel)
Parameters
Type | Name | Description |
---|---|---|
GridCellModelBase | cellModel | The value to locate in the GridCellModelCollection. |
Returns
Type | Description |
---|---|
System.Boolean | true if the GridCellModelCollection contains an element with the specified value; otherwise, false. |
CopyTo(GridCellModelBase[], Int32)
Copies the cell model dictionary values to a one-dimensional System.Array instance at the specified index.
Declaration
public virtual void CopyTo(GridCellModelBase[] array, int index)
Parameters
Type | Name | Description |
---|---|---|
GridCellModelBase[] | array | The one-dimensional System.Array that is the destination of the values copied from the GridCellModelCollection. |
System.Int32 | index |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
GetEnumerator()
Returns an enumerator that can iterate through the cell model dictionary.
Declaration
public virtual IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator that can iterate through the string dictionary. |
OnCollectionChanged(CollectionChangeEventArgs)
Raises the CellModelsChanged event.
Declaration
protected virtual void OnCollectionChanged(CollectionChangeEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.CollectionChangeEventArgs | e | A System.ComponentModel.CollectionChangeEventArgs that contains the event data. |
Remove(String)
Removes the entry with the specified cellTypeName from the cell model dictionary.
Declaration
public virtual void Remove(string cellTypeName)
Parameters
Type | Name | Description |
---|---|---|
System.String | cellTypeName | The cellTypeName of the entry to remove. |