Class GridVirtualizingCellRendererBase<D, E>
VirtualizingCellRendererBase is an abstract base class for cell renderers that need live UIElement visuals displayed in a cell. You can derive from this class and provide the type of the UIElement you want to show inside cells as type parameter. The class provides strong typed virtual methods for initializing content of the cell and arranging the cell visuals.
The class manages the creation of cells UIElement objects when the cell is scrolled into view and also unloading of the elements. The class offers an optimization in which elements can be recycled when AllowRecycle is set. In this case when a cell is scrolled out of view it is moved into a recycle bin and the next time a new element is scrolled into view the element is recovered from the recycle bin and reinitialized with the new content of the cell.
when the user moves the mouse over the cell or if the UIElement is needed for other reasons.
After a UIElement was created the virtual methods Syncfusion.UI.Xaml.Grid.Cells.GridVirtualizingCellRendererBase`2.WireEditUIElement(`1) and Syncfusion.UI.Xaml.Grid.Cells.GridVirtualizingCellRendererBase`2.UnwireEditUIElement(`1) are called to wire any event listeners.
Updates to appearance and content of child elements, creation and unloading of elements will not trigger ArrangeOverride or Render calls in parent canvas.
Inheritance
Inherited Members
Namespace: Syncfusion.UI.Xaml.Grid.Cells
Assembly: Syncfusion.SfGrid.WPF.dll
Syntax
public abstract class GridVirtualizingCellRendererBase<D, E> : GridCellRendererBase, IGridCellRenderer, IDisposable where D : FrameworkElement, new()
where E : FrameworkElement, new()
Type Parameters
Name | Description |
---|---|
D | The type of the UIElement that should be placed inside cells in display mode. |
E | The type of the UIElement that should be placed inside cells in edit mode. |
Constructors
GridVirtualizingCellRendererBase()
Initializes a new instance of the GridVirtualizingCellRendererBase<D, E> class.
Declaration
public GridVirtualizingCellRendererBase()
Properties
AllowRecycle
Gets or sets a value that indicates whether elements can be recycled when scrolled out of view.
Declaration
public bool AllowRecycle { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if elements can be recycled when scrolled out of view; otherwise, false. The default value is false. |
Remarks
The elements moved into a recycle bin when a cell is scrolled out of view and the next time a new element is scrolled into view the element is recovered from the recycle bin and reinitialized with the new content of the cell.
DisplayRecycleBin
Gets the DisplayRecycleBin.
Declaration
protected VirtualizingCellUIElementBin<D> DisplayRecycleBin { get; }
Property Value
Type |
---|
VirtualizingCellUIElementBin<D> |
EditRecycleBin
Gets the EditRecycleBin.
Declaration
protected VirtualizingCellUIElementBin<E> EditRecycleBin { get; }
Property Value
Type |
---|
VirtualizingCellUIElementBin<E> |
TemplateRecycleBin
Gets the TemplateRecycleBin.
Declaration
protected VirtualizingCellUIElementBin<ContentControl> TemplateRecycleBin { get; }
Property Value
Type |
---|
VirtualizingCellUIElementBin<System.Windows.Controls.ContentControl> |
Methods
BeginEdit(RowColumnIndex, FrameworkElement, GridColumn, Object)
Starts an edit operation on a current cell.
Declaration
public override bool BeginEdit(RowColumnIndex cellRowColumnIndex, FrameworkElement cellElement, GridColumn column, object record)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Specifies the row and column index of the cell to start an edit operation. |
System.Windows.FrameworkElement | cellElement | Specifies the UIElement of the cell to start an edit operation. |
GridColumn | column | Specifies the corresponding GridColumn to edit the cell. |
System.Object | record | Specifies the corresponding record to edit the cell. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the current cell starts an editing; otherwise, false. |
Overrides
ClearRecycleBin()
Clears the recycle bin.
Declaration
public override void ClearRecycleBin()
Overrides
Dispose(Boolean)
Releases all resources used by the
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing |
Overrides
DrawFormattedText(DrawingContext, Rect, Geometry, DataColumnBase, GridCell, String)
Declaration
protected virtual void DrawFormattedText(DrawingContext dc, Rect cellRect, Geometry clipGeometry, DataColumnBase dataColumnBase, GridCell gridCell, string cellvalue)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Media.Geometry | clipGeometry | |
DataColumnBase | dataColumnBase | |
GridCell | gridCell | |
System.String | cellvalue |
DrawGlyphs(DrawingContext, Rect, Geometry, DataColumnBase, GridCell, String)
Declaration
protected virtual void DrawGlyphs(DrawingContext dc, Rect cellRect, Geometry clipGeometry, DataColumnBase dataColumnBase, GridCell gridCell, string cellvalue)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Media.Geometry | clipGeometry | |
DataColumnBase | dataColumnBase | |
GridCell | gridCell | |
System.String | cellvalue |
EndEdit(DataColumnBase, Object, Boolean)
Ends the edit occurring on the cell.
Declaration
public override bool EndEdit(DataColumnBase dc, object record, bool canResetBinding = false)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dc | Specifies the corresponding DataColumnBase of the cell to complete the edit operation. |
System.Object | record | Specifies the corresponding record to complete the edit operation. |
System.Boolean | canResetBinding | Specifies whether the binding can be reset or not. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the edit ends on the cell ; otherwise, false. |
Overrides
InitializeCellStyle(DataColumnBase, Object)
Initializes the custom style for cell when the corresponding API's and Selectors are used.
Declaration
protected virtual void InitializeCellStyle(DataColumnBase dataColumn, object record)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The corresponding DataColumn Which holds GridColumn, RowColumnIndex and GridCell to initialize cell style. |
System.Object | record | The corresponding record to initialize cell style. |
InitializeDisplayElement(DataColumnBase, D, Object)
Initializes the display element of the cell in column.
Declaration
public virtual void InitializeDisplayElement(DataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the DataColumnBase of the cell. |
D | uiElement | Specifies the uiElement that is initialized on the display element of cell. |
System.Object | dataContext | Specifies the dataContext of the cell. |
InitializeEditElement(DataColumnBase, E, Object)
Initializes an edit element of the cell in column.
Declaration
public void InitializeEditElement(DataColumnBase dataColumn, E uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the DataColumnBase of the cell. |
E | uiElement | Specifes the element that is initialized on the edit element of cell. |
System.Object | dataContext | Specifies the dataContext of the cell. |
InitializeTemplateElement(DataColumnBase, ContentControl, Object)
Invoked when the template element is initialized on the cell.
Declaration
public void InitializeTemplateElement(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
System.Windows.Controls.ContentControl | uiElement | Specifies the corresponding uiElement to initialize the template element. |
System.Object | dataContext | Specifies the data context of the cell. |
OnArrange(RowColumnIndex, FrameworkElement, Rect)
Invoked when the visual children of cell is arranged in view.
Declaration
protected override void OnArrange(RowColumnIndex cellRowColumnIndex, FrameworkElement uiElement, Rect cellRect)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Specifies the corresponding row and column index of the cell. |
System.Windows.FrameworkElement | uiElement | Specifies the corresponding UiElement that is to be arranged. |
System.Windows.Rect | cellRect | Specifies the corresponding size of cell element for arranging the UIElement. |
Overrides
OnCreateDisplayUIElement()
Creates a new UIElement for the display mode of cell.
Declaration
protected virtual D OnCreateDisplayUIElement()
Returns
Type | Description |
---|---|
D | Returns the new UIElement for display mode of cell. |
OnCreateEditUIElement()
Creates a new UIElement for the edit mode of cell.
Declaration
protected virtual E OnCreateEditUIElement()
Returns
Type | Description |
---|---|
E | Returns the new UIElement for edit mode of cell. |
OnCreateTemplateUIElement()
Declaration
protected virtual ContentControl OnCreateTemplateUIElement()
Returns
Type |
---|
System.Windows.Controls.ContentControl |
OnEditElementLoaded(Object, RoutedEventArgs)
Invoked when the edit element is loaded on the cell in column.
Declaration
protected virtual void OnEditElementLoaded(object sender, RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender that contains the corresponding edit UIElement. |
System.Windows.RoutedEventArgs | e | The System.Windows.RoutedEventArgs instance containing the event data. |
OnEditElementLostFocus(Object, RoutedEventArgs)
Invoked when the edit element loses its focus on the cell.
Declaration
protected virtual void OnEditElementLostFocus(object sender, RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender that contains the corresponding edit UIElement. |
System.Windows.RoutedEventArgs | e | The System.Windows.RoutedEventArgs that contains event data. |
OnEditElementUnloaded(Object, RoutedEventArgs)
Invoked when the edit element is unloaded on the cell in column.
Declaration
protected virtual void OnEditElementUnloaded(object sender, RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | The sender that contains the corresponding edit UIElement. |
System.Windows.RoutedEventArgs | e | The System.Windows.RoutedEventArgs instance containing the event data. |
OnEditingComplete(DataColumnBase, FrameworkElement)
Invoked when the editing is completed on the cell.
Declaration
protected virtual void OnEditingComplete(DataColumnBase dataColumn, FrameworkElement currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
System.Windows.FrameworkElement | currentRendererElement | Specifies the corresponding renderer element of the cell. |
OnEnteredEditMode(DataColumnBase, FrameworkElement)
Invoked when the cell is being entered on the edit mode.
Declaration
protected virtual void OnEnteredEditMode(DataColumnBase dataColumn, FrameworkElement currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell being entered on the edit mode. |
System.Windows.FrameworkElement | currentRendererElement | Specifies the corresponding renderer element of the cell in edit mode. |
OnInitializeDisplayElement(DataColumnBase, D, Object)
Invoked when the display element is initialized on the cell.
Declaration
public abstract void OnInitializeDisplayElement(DataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
D | uiElement | Specifies the uiElement that is initialized on the display element of cell. |
System.Object | dataContext | Specifies the dataContext of the cell. |
OnInitializeEditElement(DataColumnBase, E, Object)
Invoked when the edit element is initialized on the cell.
Declaration
public abstract void OnInitializeEditElement(DataColumnBase dataColumn, E uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
E | uiElement | Specifies the element that is initialized on the edit element of cell. |
System.Object | dataContext | Specifies the dataContext of the cell. |
OnInitializeTemplateElement(DataColumnBase, ContentControl, Object)
Invoked when the template element is initialized on the cell.
Declaration
public abstract void OnInitializeTemplateElement(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
System.Windows.Controls.ContentControl | uiElement | Specifies the corresponding uiElement to initialize the template element. |
System.Object | dataContext | Specifies the data context of the cell. |
OnMeasure(RowColumnIndex, FrameworkElement, Size)
Invoked when the desired size for cell is measured.
Declaration
protected override void OnMeasure(RowColumnIndex cellRowColumnIndex, FrameworkElement uiElement, Size availableSize)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Specifies the corresponding row and column index of the cell |
System.Windows.FrameworkElement | uiElement | Specifies the corresponding UiElement to measure. |
System.Windows.Size | availableSize | Specifies the available size that a parent element can allocate the cell. |
Overrides
OnPrepareUIElements(DataColumnBase, Object, Boolean)
Invoked when the UIElement for cell is prepared to render it in view .
Declaration
protected override FrameworkElement OnPrepareUIElements(DataColumnBase dataColumn, object record, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | The corresponding column of the element. |
System.Object | record | The corresponding Record for the element. |
System.Boolean | isInEdit | Specifies whether the element is editable or not. |
Returns
Type | Description |
---|---|
System.Windows.FrameworkElement | Returns the new cell UIElement. |
Overrides
OnRenderCell(DrawingContext, Rect, DataColumnBase, Object)
Invoked when the visual children of cells is render in view.
Declaration
protected override void OnRenderCell(DrawingContext dc, Rect cellRect, DataColumnBase dataColumnBase, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The corresponding drawing context to draw the cell borders, cell content, cell background |
System.Windows.Rect | cellRect | The corresponding size of cell element for arranging the UIElement |
DataColumnBase | dataColumnBase | The DataColumnBase that provides the cells details. |
System.Object | dataContext | The corresponding record to draw a text for GridCell |
Overrides
OnRenderCellBorder(DrawingContext, Rect, Geometry, DataColumnBase, GridCell)
Declaration
protected override void OnRenderCellBorder(DrawingContext dc, Rect cellRect, Geometry clipGeometry, DataColumnBase dataColumnBase, GridCell gridCell)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Media.Geometry | clipGeometry | |
DataColumnBase | dataColumnBase | |
GridCell | gridCell |
Overrides
OnRenderContent(DrawingContext, Rect, Geometry, DataColumnBase, GridCell, Object)
Declaration
protected override void OnRenderContent(DrawingContext dc, Rect cellRect, Geometry clipGeometry, DataColumnBase dataColumnBase, GridCell gridCell, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Media.Geometry | clipGeometry | |
DataColumnBase | dataColumnBase | |
GridCell | gridCell | |
System.Object | dataContext |
Overrides
OnRenderCurrentCell(DrawingContext, Rect, Geometry, DataColumnBase, GridCell)
Declaration
protected override void OnRenderCurrentCell(DrawingContext dc, Rect cellRect, Geometry clipGeometry, DataColumnBase dataColumnBase, GridCell gridCell)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Media.Geometry | clipGeometry | |
DataColumnBase | dataColumnBase | |
GridCell | gridCell |
Overrides
OnUnloadUIElements(DataColumnBase)
Invoked when the cell is scrolled out of view or unloaded from the view. GridVirtualizingCellRendererBase<D, E> overrides this method and either removes the cell renderer visuals from the parent or hide them and reuse it later in same element depending on whether AllowRecycle was set.
Declaration
protected override void OnUnloadUIElements(DataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the column to unload the cell UIElement. |
Overrides
OnUnwireDisplayUIElement(D)
Unwires the events associated with display UIElement of the cell.
Declaration
protected virtual void OnUnwireDisplayUIElement(D uiElement)
Parameters
Type | Name | Description |
---|---|---|
D | uiElement | The corresponding display UIElement to unwire its events. |
OnUnwireEditUIElement(E)
Unwires the events associated with edit UIElement.
Declaration
protected virtual void OnUnwireEditUIElement(E uiElement)
Parameters
Type | Name | Description |
---|---|---|
E | uiElement | The corresponding edit UIElement to unwire its events. |
OnUnwireTemplateUIElement(ContentControl)
Unwires the events associated with template element of the cell.
Declaration
protected virtual void OnUnwireTemplateUIElement(ContentControl uiElement)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.ContentControl | uiElement | The corresponding template UIElement to unwire its events. |
OnUpdateBindingInfo(DataColumnBase, Object, Boolean)
Updates the binding of the Cell UIElement for the specified column. Implement this method to update binding when the cell UIElement is reused during horizontal scrolling.
Declaration
protected override void OnUpdateBindingInfo(DataColumnBase dataColumn, object record, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase to update binding. |
System.Object | record | Specifies the corresponding record to update binding. |
System.Boolean | isInEdit | Indicates the whether the cell is in editing or not. |
Overrides
OnUpdateDisplayBinding(DataColumnBase, D, Object)
Updates the binding for display element of cell in column.
Declaration
public abstract void OnUpdateDisplayBinding(DataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
D | uiElement | Specifies the corresponding uiElement to update display element. |
System.Object | dataContext | Specifies the data context of the cell. |
OnUpdateEditBinding(DataColumnBase, E, Object)
Updates the binding for edit element of cell in column.
Declaration
public abstract void OnUpdateEditBinding(DataColumnBase dataColumn, E element, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
E | element | Specifies the corresponding element to update binding of edit element. |
System.Object | dataContext | Specifies the data context of the cell. |
OnUpdateStyleInfo(DataColumnBase, Object)
Updates the style for the particular column. Implement this method to update style when the cell UIElement is reused during scrolling.
Declaration
protected override sealed void OnUpdateStyleInfo(DataColumnBase dataColumn, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase to update style. |
System.Object | dataContext | Specifies the data context. |
Overrides
OnUpdateTemplateBinding(DataColumnBase, ContentControl, Object)
Updates the binding for template element of cell in column.
Declaration
public abstract void OnUpdateTemplateBinding(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
DataColumnBase | dataColumn | Specifies the corresponding DataColumnBase of the cell. |
System.Windows.Controls.ContentControl | uiElement | Specifies the corresponding uiElement to update template element. |
System.Object | dataContext | Specifies the data context of the cell. |
OnWireDisplayUIElement(D)
Wires the events associated with display UIElement of the cell.
Declaration
protected virtual void OnWireDisplayUIElement(D uiElement)
Parameters
Type | Name | Description |
---|---|---|
D | uiElement | The corresponding display UIElement to wire its events. |
OnWireEditUIElement(E)
Wires the events associated with edit UIElement.
Declaration
protected virtual void OnWireEditUIElement(E uiElement)
Parameters
Type | Name | Description |
---|---|---|
E | uiElement | The corresponding edit UIElement to wire its events. |
OnWireTemplateUIElement(ContentControl)
Wires the events associated with template element of the cell.
Declaration
protected virtual void OnWireTemplateUIElement(ContentControl uiElement)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Controls.ContentControl | uiElement | The corresponding template UIElement to wire its events. |