Class GridCellMultiColumnDropDownRenderer
Represents the class that loads the SfMultiColumnDropDownControl as the editor element for the GridMultiColumnDropDownList column in SfDataGrid.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.Grid.Cells
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public class GridCellMultiColumnDropDownRenderer : GridVirtualizingCellRenderer<TextBlock, SfMultiColumnDropDownControl>, IGridCellRenderer, IDisposable
Remarks
The GridCellMultiColumnDropDownRenderer is the default cell renderer registered with the key
MultiColumnDropDown in the CellRenderers
collection. It is used to render and edit the cells of
GridMultiColumnDropDownList columns by displaying the
selected value as a System.Windows.Controls.TextBlock in display mode and hosting a
SfMultiColumnDropDownControl in edit mode.
Constructors
GridCellMultiColumnDropDownRenderer()
Initializes a new instance of the GridCellMultiColumnDropDownRenderer class.
Declaration
public GridCellMultiColumnDropDownRenderer()
Remarks
The default constructor sets the true so that the SfMultiColumnDropDownControl drop-down
can be opened when the cell enters edit mode.
Methods
EndEdit(DataColumnBase, Object, Boolean)
Ends the editing of the current cell that hosts the SfMultiColumnDropDownControl editor and commits the edited value to the underlying record.
Declaration
public override bool EndEdit(DataColumnBase dc, object record, bool canResetBinding = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DataColumnBase | dc | The DataColumnBase that contains the GridColumn, RowColumnIndex, and GridCell information for the renderer element. |
| System.Object | record | The underlying record that corresponds to the cell being edited. |
| System.Boolean | canResetBinding | A boolean value indicating whether the binding of the SelectedValue can be cleared while ending the edit operation. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns |
Overrides
Remarks
When canResetBinding is true, the binding of the
SelectedValue property is cleared before
delegating the call to the base implementation.
GetControlValue()
Returns the current value of the GridCellMultiColumnDropDownRenderer editor element.
Declaration
public override object GetControlValue()
Returns
| Type | Description |
|---|---|
| System.Object | Returns the SelectedValue when the cell is in edit mode; otherwise, returns the System.Windows.Controls.TextBlock.Text value of the display element. |
Overrides
Remarks
If the current cell state is not initialized, the value returned by the base implementation is returned. This method is called by the SfDataGrid while committing the edited value of the cell to the underlying data source.
OnCreateEditUIElement()
Creates a new SfMultiColumnDropDownControl element to be used as the edit UI element for the GridMultiColumnDropDownList column.
Declaration
protected override SfMultiColumnDropDownControl OnCreateEditUIElement()
Returns
| Type | Description |
|---|---|
| SfMultiColumnDropDownControl | A new SfMultiColumnDropDownControl instance that is used as the editor element when the cell enters edit mode. |
Overrides
Remarks
Overrides the base implementation to provide a SfMultiColumnDropDownControl instance as the edit element. In the WPF platform, the border thickness of the control is reset to a thickness of 1 to match the appearance of the cell.
OnEditElementLoaded(Object, RoutedEventArgs)
Creates a new SfMultiColumnDropDownControl element to be used as the edit UI element for the GridMultiColumnDropDownList column.
Declaration
protected override void OnEditElementLoaded(object sender, RoutedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | sender | |
| System.Windows.RoutedEventArgs | e |
Overrides
Remarks
Overrides the base implementation to provide a SfMultiColumnDropDownControl instance as the edit element. In the WPF platform, the border thickness of the control is reset to a thickness of 1 to match the appearance of the cell.
OnEnteredEditMode(DataColumnBase, FrameworkElement)
Called when the GridCellMultiColumnDropDownRenderer cell has entered edit mode.
Declaration
protected override void OnEnteredEditMode(DataColumnBase dataColumn, FrameworkElement currentRendererElement)
Parameters
| Type | Name | Description |
|---|---|---|
| DataColumnBase | dataColumn | The DataColumnBase that contains the GridColumn, RowColumnIndex, and GridCell information for the renderer element. |
| System.Windows.FrameworkElement | currentRendererElement | The System.Windows.FrameworkElement that represents the current edit element of the cell. |
Overrides
Remarks
Overrides the base implementation to disable the mouse input on the current renderer element in the WPF platform, so that the editor element receives all mouse interactions while the cell is being edited.
OnInitializeDisplayElement(DataColumnBase, TextBlock, Object)
Called when the display element is initialized for the GridMultiColumnDropDownList cell. Updates the padding of the System.Windows.Controls.TextBlock based on the padding defined on the GridColumn.
Declaration
public override void OnInitializeDisplayElement(DataColumnBase dataColumn, TextBlock uiElement, object dataContext)
Parameters
| Type | Name | Description |
|---|---|---|
| DataColumnBase | dataColumn | The DataColumnBase instance that holds the GridColumn, RowColumnIndex, and the GridCell information for the renderer element. |
| System.Windows.Controls.TextBlock | uiElement | The System.Windows.Controls.TextBlock element that represents the display UI element. |
| System.Object | dataContext | The data context of the cell, which is the underlying record being displayed. |
Overrides
OnInitializeEditElement(DataColumnBase, SfMultiColumnDropDownControl, Object)
Called when the edit element is initialized for the GridMultiColumnDropDownList cell. Initializes the SfMultiColumnDropDownControl with the bindings required for two-way data binding with the GridColumn.
Declaration
public override void OnInitializeEditElement(DataColumnBase dataColumn, SfMultiColumnDropDownControl uiElement, object dataContext)
Parameters
| Type | Name | Description |
|---|---|---|
| DataColumnBase | dataColumn | The DataColumnBase instance that holds the GridColumn, RowColumnIndex, and the GridCell information for the renderer element. |
| SfMultiColumnDropDownControl | uiElement | The SfMultiColumnDropDownControl element that represents the edit UI element. |
| System.Object | dataContext | The data context of the cell, which is the underlying record being edited. |
Overrides
Remarks
Sets up bindings for properties such as SelectedValue, DisplayMember,
ValueMember, PopupWidth, PopupHeight, AllowAutoComplete,
AllowIncrementalFiltering, SearchCondition, and other drop-down specific
options exposed by the GridMultiColumnDropDownList
column. The
OnUnwireEditUIElement(SfMultiColumnDropDownControl)
Unwires the SfMultiColumnDropDownControl edit element from the renderer when the cell leaves edit mode.
Declaration
protected override void OnUnwireEditUIElement(SfMultiColumnDropDownControl uiElement)
Parameters
| Type | Name | Description |
|---|---|---|
| SfMultiColumnDropDownControl | uiElement | The SfMultiColumnDropDownControl edit element to be unwired. |
Overrides
Remarks
Detaches the SelectionChanged event handler
that was wired in PreviewMouseDown handler is also detached to prevent
memory leaks.
SetControlValue(Object)
Sets the value to the SfMultiColumnDropDownControl editor element of the GridMultiColumnDropDownList cell.
Declaration
public override void SetControlValue(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | value | The value to be assigned to the SelectedItem of the editor element. |
Overrides
Remarks
This method updates the SelectedItem of the editor element only when the cell is in edit mode. If the cell is not in edit mode, an exception is raised indicating that the value cannot be set for an unloaded editor.
Exceptions
| Type | Condition |
|---|---|
| System.Exception | Thrown when the editor element is not loaded. |
ShouldGridTryToHandleKeyDown(KeyEventArgs)
Determines whether the SfDataGrid should attempt to handle the key down event raised while the SfMultiColumnDropDownControl cell is being edited.
Declaration
protected override bool ShouldGridTryToHandleKeyDown(KeyEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs instance containing the event data. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Returns |
Overrides
Remarks
Overrides the base implementation to honor the navigation keys (such as System.Windows.Input.Key.Escape, System.Windows.Input.Key.Up, System.Windows.Input.Key.Down, System.Windows.Input.Key.PageUp, System.Windows.Input.Key.PageDown, and System.Windows.Input.Key.Enter) when the drop-down of the SfMultiColumnDropDownControl is open, and to route caret navigation keys to the grid based on the caret position and modifier keys.