Class GridComboBoxCellModel
Implements the data or model part for a combo box cell.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Windows.Forms.Grid
Assembly: Syncfusion.Grid.Windows.dll
Syntax
public class GridComboBoxCellModel : GridDropDownCellModel, ISerializable, IDisposable
Remarks
You typically access cell models through the CellModels property of the GridModel class.
A GridComboBoxCellModel can serve as model for several GridComboBoxCellRenderer instances if there are several GridControlBase views for a GridModel.
See GridComboBoxCellRenderer for more detailed information about this cell type.
Constructors
GridComboBoxCellModel(GridModel)
Initializes a new GridComboBoxCellModel object and stores a reference to the GridModel this cell belongs to.
Declaration
public GridComboBoxCellModel(GridModel grid)
Parameters
Type | Name | Description |
---|---|---|
GridModel | grid | The GridModel for this cell model. |
Remarks
You typically access cell models through the CellModels property of the GridModel class.
GridComboBoxCellModel(SerializationInfo, StreamingContext)
Initializes a new GridComboBoxCellModel from a serialization stream.
Declaration
protected GridComboBoxCellModel(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
System.Runtime.Serialization.SerializationInfo | info | An object that holds all the data needed to serialize or de-serialize this instance. |
System.Runtime.Serialization.StreamingContext | context | Describes the source and destination of the serialized stream specified by info. |
Properties
AllowDoubleClickChangeSelectedIndex
Gets or sets a value indicating whether to enable or turn off selecting the next index when user double clicks inside cell.
Declaration
public bool AllowDoubleClickChangeSelectedIndex { get; set; }
Property Value
Type |
---|
System.Boolean |
CacheDataSource
Declaration
[Obsolete("Problem with sluggish list boxes has been fixed. Set also GridStyleInfoStore.DataSourceProperty.IsCloneable and GridStyleInfoStore.DataSourceProperty.IsDisposable = false")]
public bool CacheDataSource { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
ApplyFormattedText(GridStyleInfo, String, Int32)
Parses the display text and converts it into a cell value to be stored in the style object.
Declaration
public override 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 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. |
Overrides
CreateRenderer(GridControlBase)
Creates a GridComboBoxCellRenderer for this cell model that is specific to the GridControlBase.
Declaration
public override GridCellRendererBase CreateRenderer(GridControlBase control)
Parameters
Type | Name | Description |
---|---|---|
GridControlBase | control | The GridControlBase the cell renderer is created for. |
Returns
Type | Description |
---|---|
GridCellRendererBase | A new GridComboBoxCellRenderer specific for a GridControlBase. |
Overrides
Examples
This example shows how to create the renderer for the cell model.
GridCellModelBase cellModel = grid.Model.CellModels[key];
GridCellRendererBase renderer = cellModel.CreateRenderer(grid);
Dispose(Boolean)
Disposes the unmanaged resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
FillWithChoices(ListBox, GridStyleInfo, out Boolean)
Initializes a System.Windows.Form.ListBox with data binding information from a GridStyleInfo object.
Declaration
public virtual void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.ListBox | listBox | The list box to be initialized with data binding information |
GridStyleInfo | style | The style object with binding information. |
System.Boolean | exclusive | A place holder that returns whether the list box is filled with an exclusive list of possible choices or if non-standard values are allowed. |
FindValue(GridStyleInfo, Object)
Returns the index in the drop-down list box for the specified cell value / key.
Declaration
public int FindValue(GridStyleInfo style, object value)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The GridStyleInfo object that holds cell information. |
System.Object | value | The value (same as ValueMember). |
Returns
Type | Description |
---|---|
System.Int32 | The index in the drop-down list box or -1 if not found. |
GetDataSource(GridStyleInfo)
This is called to initialize data source on demand. This lets you calculate the data source only when it is needed and not every time in QueryStyleInfo. Default behavior is to return style.ChoiceList if not empty. If style.ChoiceList is empty, style.DataSource is returned.
Declaration
public virtual object GetDataSource(GridStyleInfo style)
Parameters
Type | Name | Description |
---|---|---|
GridStyleInfo | style | The style object with binding information. |
Returns
Type | Description |
---|---|
System.Object | Data source. |
GetFormattedText(GridStyleInfo, Object, Int32)
This is called from GridStyleInfo.GetFormattedText. GridStyleInfo.CultureInfo is used for conversion to string.
Declaration
public override 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 who is calling, default is GridCellBaseTextInfo.DisplayText. |
Returns
Type | Description |
---|---|
System.String | The formatted text for the given value. |
Overrides
GetItemValue(Object, String, Object)
Returns the value for the ValueMember of the specified item.
Declaration
public object GetItemValue(object dataSource, string valueMember, object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | dataSource | The data source list |
System.String | valueMember | The name of the value member |
System.Object | item | The row item. |
Returns
Type | Description |
---|---|
System.Object | The value of the ValueMember. |