Class GridCellModelBase
Defines the model for a cell type.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Controls.Grid
Assembly: Syncfusion.Grid.Wpf.dll
Syntax
public class GridCellModelBase : Disposable, IDisposable
Remarks
You typically access cell models through the CellModels property of the GridModel class.
Constructors
GridCellModelBase()
Initializes a new GridCellModelBase.
Declaration
public GridCellModelBase()
Properties
ActiveRenderer
Returns the active cell renderer object.
Declaration
public IGridCellRenderer ActiveRenderer { get; set; }
Property Value
Type |
---|
IGridCellRenderer |
GridModel
Gets or sets the grid model for the cell.
Declaration
public GridModel GridModel { get; set; }
Property Value
Type |
---|
GridModel |
MeasureEmptyCellString
This string is used when doing a resize to fit for cells with empty text.
Declaration
public static string MeasureEmptyCellString { get; set; }
Property Value
Type |
---|
System.String |
Methods
AddBorderMargins(Size, Thickness)
Add border margins to get cells client area.
Declaration
public Size AddBorderMargins(Size cellRect, Thickness mi)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | cellRect | The cell rectangle |
System.Windows.Thickness | mi | Margins. |
Returns
Type | Description |
---|---|
System.Windows.Size | Size of the cell client area. |
ApplyFormattedText(GridStyleInfo, String, Int32)
Parses the display text and converts it into a cell value to be stored in the style object. GridStyleInfo.CultureInfo is used for parsing the string.
Declaration
public virtual bool ApplyFormattedText(GridStyleInfo style, string text, int textInfo)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.String | text | The input text to be parsed. |
System.Int32 | textInfo | TextInfo is a hint of who is calling, default is GridCellBaseTextInfo.DisplayText |
Returns
Type | Description |
---|---|
System.Boolean | True if value was parsed correctly and saved in style object as CellValue; False otherwise. |
ApplyText(GridStyleInfo, String)
Parses the text and converts it into a cell value to be stored in the style object (ignoring any Format settings). CultureInfo.CurrentText is used for parsing the string.
Declaration
public virtual bool ApplyText(GridStyleInfo style, string text)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.String | text | The input text to be parsed. |
Returns
Type | Description |
---|---|
System.Boolean | True if value was parsed correctly and saved in style object as CellValue; False otherwise. |
CalculatePreferredCellSize(Int32, Int32, GridStyleInfo, GridQueryBounds)
Calculates the preferred size of the cell based on its contents, including margins and any buttons.
Declaration
public virtual Size CalculatePreferredCellSize(int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
GridQueryBounds | queryBounds | Vertical or horizontal |
Returns
Type | Description |
---|---|
System.Windows.Size | The optimal size of the cell. |
Clone()
Creates a shallow copy of current GridCellModelBase object.
Declaration
public virtual GridCellModelBase Clone()
Returns
Type | Description |
---|---|
GridCellModelBase | A copy of current object. |
CreateRenderer()
Creates cell renderer.
Declaration
public virtual IGridCellRenderer CreateRenderer()
Returns
Type | Description |
---|---|
IGridCellRenderer | Throws Not Implemented exception. |
Remarks
You must override this method in your implementation of GridCellModelBase.
GetCellClientSize(Int32, Int32, GridStyleInfo)
Gets the actual size of the cell without margins. Spanned cells will return the size of the whole cell covering neighboring cells.
Declaration
public Size GetCellClientSize(int rowIndex, int colIndex, GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
Returns
Type | Description |
---|---|
System.Windows.Size | The actual System.Windows.Size of the cell without margins or cell buttons. |
GetCellSize(Int32, Int32)
Gets the actual size of the cell including margins. Spanned cells will return the size of the whole cell covering neighboring cells.
Declaration
public Size GetCellSize(int rowIndex, int colIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
Returns
Type | Description |
---|---|
System.Windows.Size | The actual System.Windows.Size of the cell including margins and cell buttons. |
GetFormattedText(GridStyleInfo, Object, Int32)
This is called from GridStyleInfo.GetFormattedText. GridStyleInfo.CultureInfo is used for conversion to string.
Declaration
public virtual string GetFormattedText(GridStyleInfo style, object value, int textInfo)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.Object | value | The value to format. |
System.Int32 | textInfo | TextInfo is a hint of who is calling, default is GridCellBaseTextInfo.DisplayText. |
Returns
Type | Description |
---|---|
System.String | The formatted text for the given value. |
GetPropertyDescriptor(GridStyleInfo)
Returns GridStyleInfo.PropertyDescriptor.
Declaration
public virtual PropertyDescriptor GetPropertyDescriptor(GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The style object |
Returns
Type | Description |
---|---|
System.ComponentModel.PropertyDescriptor | A PropertyDescriptor |
GetText(GridStyleInfo, Object)
This is called from GridStyleInfo.GetText (ignoring any Format settings). CultureInfo.CurrentText is used for conversion to string.
Declaration
public virtual string GetText(GridStyleInfo style, object value)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.Object | value | The value to convert to a string. |
Returns
Type | Description |
---|---|
System.String | The string that represents the given value. |
GetTypeConverter(GridStyleInfo)
Returns a TypeConverter with type information about the style.CellValue.
Declaration
public virtual TypeConverter GetTypeConverter(GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The style object |
Returns
Type | Description |
---|---|
System.ComponentModel.TypeConverter | A TypeConverter |
OnCreated()
Occurs when the cell model is created.
Declaration
public virtual void OnCreated()
OnQueryPrefferedClientSize(Int32, Int32, GridStyleInfo, GridQueryBounds)
Calculates the preferred size of the cell based on its contents without margins and any buttons.
Declaration
protected virtual Size OnQueryPrefferedClientSize(int rowIndex, int colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | The row index. |
System.Int32 | colIndex | The column index. |
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
GridQueryBounds | queryBounds |
Returns
Type | Description |
---|---|
System.Windows.Size | The optimal size of the cell. |
RaiseCurrentCellContentChanged()
Signifies the current cell change.
Declaration
public void RaiseCurrentCellContentChanged()
RemoveBorderMargins(Size, Thickness)
Remove border margins to get cells client area.
Declaration
public Size RemoveBorderMargins(Size cellRect, Thickness mi)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | cellRect | The cell rectangle. |
System.Windows.Thickness | mi | Border margins |
Returns
Type | Description |
---|---|
System.Windows.Size | The cell client area. |