WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridVirtualizingCellRendererBase<D, E>

    Show / Hide Table of Contents

    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.DataGrid.Renderers.GridVirtualizingCellRendererBase`2.WireEditUIElement(`1) and Syncfusion.UI.Xaml.DataGrid.Renderers.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
    System.Object
    GridCellRendererBase
    GridVirtualizingCellRendererBase<D, E>
    GridVirtualizingCellRenderer<D, E>
    Implements
    IGridCellRenderer
    System.IDisposable
    Inherited Members
    GridCellRendererBase.OnPrepareUIElements()
    GridCellRendererBase.OnPreviewTextInput(KeyRoutedEventArgs)
    GridCellRendererBase.CanValidate()
    GridCellRendererBase.CanUpdateBinding(GridColumn)
    GridCellRendererBase.CommitUnboundCellValue(Object, GridColumn, Object)
    GridCellRendererBase.UpdateToolTip(DataColumnBase)
    GridCellRendererBase.ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
    GridCellRendererBase.SetFocus(FrameworkElement, Boolean)
    GridCellRendererBase.IGridCellRenderer.ShouldGridTryToHandleKeyDown(KeyRoutedEventArgs)
    GridCellRendererBase.Arrange(RowColumnIndex, FrameworkElement, Rect)
    GridCellRendererBase.Measure(RowColumnIndex, FrameworkElement, Size)
    GridCellRendererBase.PrepareUIElements(DataColumnBase, Object, Boolean)
    GridCellRendererBase.UnloadUIElements(DataColumnBase)
    GridCellRendererBase.IGridCellRenderer.UpdateBindingInfo(DataColumnBase, Object, Boolean)
    GridCellRendererBase.UpdateBindingInfo(DataColumnBase, Object, Boolean)
    GridCellRendererBase.UpdateCellStyle(DataColumnBase, Object)
    GridCellRendererBase.PreviewTextInput(KeyRoutedEventArgs)
    GridCellRendererBase.GetControlValue()
    GridCellRendererBase.SetControlValue(Object)
    GridCellRendererBase.SetCurrentCellState(RowColumnIndex, FrameworkElement, Boolean, Boolean, GridColumn, DataColumnBase)
    GridCellRendererBase.UpdateCurrentCellState(FrameworkElement, Boolean)
    GridCellRendererBase.ResetCurrentCellState()
    GridCellRendererBase.SetFocus(Boolean)
    GridCellRendererBase.UpdateSource(FrameworkElement)
    GridCellRendererBase.Dispose()
    GridCellRendererBase.PreviewInputText
    GridCellRendererBase.DataGrid
    GridCellRendererBase.BindingExpression
    GridCellRendererBase.SupportsRenderOptimization
    GridCellRendererBase.UseOnlyRendererElement
    GridCellRendererBase.HasCurrentCellState
    GridCellRendererBase.CurrentCellIndex
    GridCellRendererBase.CurrentCellElement
    GridCellRendererBase.CurrentCellRendererElement
    GridCellRendererBase.IsInEditing
    GridCellRendererBase.IsFocused
    GridCellRendererBase.IsEditable
    GridCellRendererBase.IsFocusible
    GridCellRendererBase.IsDropDownable
    Namespace: Syncfusion.UI.Xaml.DataGrid.Renderers
    Assembly: Syncfusion.Grid.WinUI.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 Description
    VirtualizingCellUIElementBin<D>

    EditRecycleBin

    Gets the EditRecycleBin.

    Declaration
    protected VirtualizingCellUIElementBin<E> EditRecycleBin { get; }
    Property Value
    Type Description
    VirtualizingCellUIElementBin<E>

    TemplateRecycleBin

    Gets the TemplateRecycleBin.

    Declaration
    protected VirtualizingCellUIElementBin<ContentControl> TemplateRecycleBin { get; }
    Property Value
    Type Description
    VirtualizingCellUIElementBin<Microsoft.UI.Xaml.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.

    Microsoft.UI.Xaml.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
    GridCellRendererBase.BeginEdit(RowColumnIndex, FrameworkElement, GridColumn, Object)

    ClearRecycleBin()

    Clears the recycle bin.

    Declaration
    public override void ClearRecycleBin()
    Overrides
    GridCellRendererBase.ClearRecycleBin()

    Dispose(Boolean)

    Releases all resources used by the GridVirtualizingCellRendererBase<D, E> class.

    Declaration
    protected override void Dispose(bool isDisposing)
    Parameters
    Type Name Description
    System.Boolean isDisposing
    Overrides
    GridCellRendererBase.Dispose(Boolean)

    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
    GridCellRendererBase.EndEdit(DataColumnBase, Object, Boolean)

    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.

    Microsoft.UI.Xaml.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.

    Microsoft.UI.Xaml.FrameworkElement uiElement

    Specifies the corresponding UiElement that is to be arranged.

    Windows.Foundation.Rect cellRect

    Specifies the corresponding size of cell element for arranging the UIElement.

    Overrides
    GridCellRendererBase.OnArrange(RowColumnIndex, FrameworkElement, Rect)

    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(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.

    Microsoft.UI.Xaml.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.

    Microsoft.UI.Xaml.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.

    Microsoft.UI.Xaml.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

    Microsoft.UI.Xaml.FrameworkElement uiElement

    Specifies the corresponding UiElement to measure.

    Windows.Foundation.Size availableSize

    Specifies the available size that a parent element can allocate the cell.

    Overrides
    GridCellRendererBase.OnMeasure(RowColumnIndex, FrameworkElement, Size)

    OnPrepareUIElements(DataColumnBase, Object, Boolean)

    Invoked when the UIElement for cell is prepared to render it in view . GridVirtualizingCellRendererBase<D, E> overrides this method and creates new UIElements and wires them with the parent cells control.

    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
    Microsoft.UI.Xaml.FrameworkElement

    Returns the new cell UIElement.

    Overrides
    GridCellRendererBase.OnPrepareUIElements(DataColumnBase, Object, Boolean)

    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 corresponding DataColumnBase to unload the cell UIElement.

    Overrides
    GridCellRendererBase.OnUnloadUIElements(DataColumnBase)

    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(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
    GridCellRendererBase.OnUpdateBindingInfo(DataColumnBase, Object, Boolean)

    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
    GridCellRendererBase.OnUpdateStyleInfo(DataColumnBase, Object)

    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.

    Microsoft.UI.Xaml.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
    Microsoft.UI.Xaml.Controls.ContentControl uiElement

    The corresponding template UIElement to wire its events.

    Implements

    IGridCellRenderer
    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved