Class TreeGridVirtualizingCellRendererBase<D, E>
TreeGridVirtualizingCellRendererBase 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.TreeGrid.Renderers.TreeGridVirtualizingCellRendererBase`2.WireEditUIElement(`1) and Syncfusion.UI.Xaml.TreeGrid.Renderers.TreeGridVirtualizingCellRendererBase`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.TreeGrid.Renderers
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public abstract class TreeGridVirtualizingCellRendererBase<D, E> : TreeGridCellRendererBase, ITreeGridCellRenderer, 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
TreeGridVirtualizingCellRendererBase()
Initializes a new instance of the TreeGridVirtualizingCellRendererBase<D, E> class.
Declaration
public TreeGridVirtualizingCellRendererBase()
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 | Description |
---|---|
VirtualizingCellUIElementBin<D> | Returns the DisplayRecycleBin value. |
EditRecycleBin
Gets the EditRecycleBin.
Declaration
protected VirtualizingCellUIElementBin<E> EditRecycleBin { get; }
Property Value
Type | Description |
---|---|
VirtualizingCellUIElementBin<E> | Returns the EditRecycleBin value. |
TemplateRecycleBin
Gets the TemplateRecycleBin.
Declaration
protected VirtualizingCellUIElementBin<ContentControl> TemplateRecycleBin { get; }
Property Value
Type | Description |
---|---|
VirtualizingCellUIElementBin<Microsoft.UI.Xaml.Controls.ContentControl> | Returns the TemplateRecycleBin value. |
Methods
BeginEdit(RowColumnIndex, FrameworkElement, TreeGridColumn, Object)
Starts an edit operation on a current cell.
Declaration
public override bool BeginEdit(RowColumnIndex cellRowColumnIndex, FrameworkElement cellElement, TreeGridColumn column, object record)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Specifies the row and column index of the cell to start an edit operation. |
Microsoft.UI.Xaml.FrameworkElement | cellElement | Specifies the UIElement of the cell to start an edit operation. |
TreeGridColumn | column | The corresponding column to edit the cell. |
System.Object | record | 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 TreeGridVirtualizingCellRendererBase<D, E> class.
Declaration
protected override void Dispose(bool isDisposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDisposing | The Boolean Value. |
Overrides
EndEdit(TreeDataColumnBase, Object, Boolean)
Ends the edit occurring on the cell.
Declaration
public override bool EndEdit(TreeDataColumnBase dc, object record, bool canResetBinding = false)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dc | The corresponding datacolumn to complete the edit operation. |
System.Object | record | The corresponding record to complete the edit operation. |
System.Boolean | canResetBinding | Specifies whether the binding is reset or not. |
Returns
Type | Description |
---|---|
System.Boolean | Returns True if the edit ends on the cell ; otherwise, False. |
Overrides
InitializeCellStyle(TreeDataColumnBase, Object)
Initializes the custom style for cell when the corresponding API's and Selectors are used.
Declaration
protected virtual void InitializeCellStyle(TreeDataColumnBase dataColumn, object record)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding DataColumn Which holds TreeGridColumn, RowColumnIndex and GridCell to initialize cell style. |
System.Object | record | The corresponding record to initialize cell style. |
InitializeDisplayElement(TreeDataColumnBase, D, Object)
Initializes the display element of the cell in column.
Declaration
public void InitializeDisplayElement(TreeDataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The dataColumn where the cell is located. |
D | uiElement | The uiElement that is initialized on the display element of cell. |
System.Object | dataContext | The dataContext of the cell. |
InitializeEditElement(TreeDataColumnBase, E, Object)
Initializes an edit element of the cell in column.
Declaration
public void InitializeEditElement(TreeDataColumnBase treeColumn, E uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | treeColumn | The dataColumn where the cell is located. |
E | uiElement | The element that is initialized on the edit element of cell. |
System.Object | dataContext | The dataContext of the cell. |
InitializeTemplateElement(TreeDataColumnBase, ContentControl, Object)
Invoked when the template element is initialized on the cell.
Declaration
public void InitializeTemplateElement(TreeDataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding dataColumn where the cell is located. |
Microsoft.UI.Xaml.Controls.ContentControl | uiElement | The corresponding uiElement to initialize the template element. |
System.Object | dataContext | 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 | The corresponding row and column index of the cell. |
Microsoft.UI.Xaml.FrameworkElement | uiElement | The corresponding UiElement that is to be arranged |
Windows.Foundation.Rect | cellRect | 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. |
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. |
Microsoft.UI.Xaml.RoutedEventArgs | e | The Microsoft.UI.Xaml.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. |
Microsoft.UI.Xaml.RoutedEventArgs | e | The Microsoft.UI.Xaml.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. |
Microsoft.UI.Xaml.RoutedEventArgs | e | The Microsoft.UI.Xaml.RoutedEventArgs instance containing the event data. |
OnEditingComplete(TreeDataColumnBase, FrameworkElement)
Invoked when the editing is completed on the cell.
Declaration
protected virtual void OnEditingComplete(TreeDataColumnBase dataColumn, FrameworkElement currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding datacolumn of the cell. |
Microsoft.UI.Xaml.FrameworkElement | currentRendererElement | The corresponding renderer element of the cell. |
OnEnteredEditMode(TreeDataColumnBase, FrameworkElement)
Invoked when the cell is being entered on the edit mode.
Declaration
protected virtual void OnEnteredEditMode(TreeDataColumnBase dataColumn, FrameworkElement currentRendererElement)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding datacolumn being entered on the edit mode. |
Microsoft.UI.Xaml.FrameworkElement | currentRendererElement | The corresponding renderer element in edit mode. |
OnInitializeDisplayElement(TreeDataColumnBase, D, Object)
Invoked when the display element is initialized on the cell.
Declaration
public abstract void OnInitializeDisplayElement(TreeDataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The dataColumn where the cell is located. |
D | uiElement | The uiElement that is initialized on the display element of cell. |
System.Object | dataContext | The dataContext of the cell. |
OnInitializeEditElement(TreeDataColumnBase, E, Object)
Invoked when the edit element is initialized on the cell.
Declaration
public abstract void OnInitializeEditElement(TreeDataColumnBase treeColumn, E uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | treeColumn | The dataColumn where the cell is located. |
E | uiElement | The element that is initialized on the edit element of cell. |
System.Object | dataContext | The dataContext of the cell. |
OnInitializeTemplateElement(TreeDataColumnBase, ContentControl, Object)
Invoked when the template element is initialized on the cell.
Declaration
public abstract void OnInitializeTemplateElement(TreeDataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding dataColumn where the cell is located. |
Microsoft.UI.Xaml.Controls.ContentControl | uiElement | The corresponding uiElement to initialize the template element. |
System.Object | dataContext | 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 | The corresponding row and column index of the cell |
Microsoft.UI.Xaml.FrameworkElement | uiElement | Specifies the corresponding UiElement to measure. |
Windows.Foundation.Size | availableSize | The available size that a parent element can allocate the cell. |
Overrides
OnPrepareUIElements(TreeDataColumnBase, Object, Boolean)
Invoked when the UIElement for cell is prepared to render it in view . TreeGridVirtualizingCellRendererBase<D, E> overrides this method and creates new UIElements and wires them with the parent cells control.
Declaration
protected override FrameworkElement OnPrepareUIElements(TreeDataColumnBase dataColumn, object record, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | 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 |
---|---|
Microsoft.UI.Xaml.FrameworkElement | Returns the new cell UIElement. |
Overrides
OnUnloadUIElements(TreeDataColumnBase)
Invoked when the cell is scrolled out of view or unloaded from the view. TreeGridVirtualizingCellRendererBase<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(TreeDataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | 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 |
---|---|---|
Microsoft.UI.Xaml.Controls.ContentControl | uiElement | The corresponding template UIElement to unwire its events. |
OnUpdateBindingInfo(TreeDataColumnBase, 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(TreeDataColumnBase dataColumn, object record, bool isInEdit)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | Specifies the corresponding column to update binding. |
System.Object | record | The corresponding record to update binding. |
System.Boolean | isInEdit | Indicates the whether the cell is editable or not. |
Overrides
OnUpdateDisplayBinding(TreeDataColumnBase, D, Object)
Updates the binding for display element of cell in column.
Declaration
public abstract void OnUpdateDisplayBinding(TreeDataColumnBase dataColumn, D uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding dataColumn where the cell is located. |
D | uiElement | The corresponding uiElement to update display element. |
System.Object | dataContext | The data context of the cell. |
OnUpdateEditBinding(TreeDataColumnBase, E, Object)
Updates the binding for edit element of cell in column.
Declaration
public abstract void OnUpdateEditBinding(TreeDataColumnBase dataColumn, E element, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding dataColumn where the cell is located. |
E | element | The corresponding element to update binding of edit element. |
System.Object | dataContext | The data context of the cell. |
OnUpdateStyleInfo(TreeDataColumn)
Updates the style for the particular column. Implement this method to update style when the cell UIElement is reused during scrolling.
Declaration
protected override void OnUpdateStyleInfo(TreeDataColumn treeDataColumn)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumn | treeDataColumn | Specifies the corresponding column to update style. |
Overrides
OnUpdateTemplateBinding(TreeDataColumnBase, ContentControl, Object)
Updates the binding for template element of cell in column.
Declaration
public abstract void OnUpdateTemplateBinding(TreeDataColumnBase dataColumn, ContentControl uiElement, object dataContext)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | The corresponding dataColumn where the cell is located. |
Microsoft.UI.Xaml.Controls.ContentControl | uiElement | The corresponding uiElement to update template element. |
System.Object | dataContext | 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 |
---|---|---|
Microsoft.UI.Xaml.Controls.ContentControl | uiElement | The corresponding template UIElement to wire its events. |
UpdateToolTip(TreeDataColumnBase)
Updates the tool tip for GridCell.
Declaration
public override void UpdateToolTip(TreeDataColumnBase dataColumn)
Parameters
Type | Name | Description |
---|---|---|
TreeDataColumnBase | dataColumn | Which holds GridColumn, Row Column Index and GridCell |