menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridVirtualizingCellRendererBase<T> - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class GridVirtualizingCellRendererBase<T>

    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.

    Another optimization is support for cells rendering themselves directly to the drawing context. When is true the UIElement will only be created 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.Windows.Controls.Grid.GridVirtualizingCellRendererBase`1.WireUIElement(`0) and Syncfusion.Windows.Controls.Grid.GridVirtualizingCellRendererBase`1.UnwireUIElement(`0) 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.

    In Grid and Tree control you should not derive from this class. Instead you should derive from the GridVirtualizingCellRendererBase and TreeVirtualizingCellRendererBase classes. These classes are the exact same code base as this class with the only difference that they derive from GridCellRendererBase and TreeCellRenderer base classes instead. It is currently not possible with C# to the base class as template type parameter. This is the reason for this copy/paste approach for the codebase of this class.

    Inheritance
    System.Object
    NonFinalizeDisposable
    Disposable
    CellRendererBase<GridRenderStyleInfo>
    GridCellRendererBase
    GridVirtualizingCellRendererBase<T>
    GridVirtualizingCellRenderer<T>
    Implements
    IGridCellRenderer
    ICellRenderer
    IHitTestSelectCells
    IStyleChanged
    System.IDisposable
    Inherited Members
    CellRendererBase<GridRenderStyleInfo>.AllowCancelMouseCapture
    CellRendererBase<GridRenderStyleInfo>.Hide(UIElement)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.Arrange(ArrangeCellArgs)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.CancelMouseCapture(UIElement)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.PrepareUIElements(ArrangeCellArgs, List<UIElement>, ScrollControlChildFrame)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.RecaptureMouse(UIElement)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.Render(DrawingContext, RenderCellArgs)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.UnloadUIElements(VirtualizingCellsControl, RowColumnIndex, CellUIElements)
    CellRendererBase<GridRenderStyleInfo>.ICellRenderer.UnloadUIElementsWhenScrolledOutOfView
    CellRendererBase<GridRenderStyleInfo>.isInArrange
    CellRendererBase<GridRenderStyleInfo>.IsInArrange
    CellRendererBase<GridRenderStyleInfo>.OnCancelMouseCapture(UIElement)
    CellRendererBase<GridRenderStyleInfo>.OnRecaptureMouse(UIElement)
    CellRendererBase<GridRenderStyleInfo>.OnRender(DrawingContext, RenderCellArgs, GridRenderStyleInfo)
    CellRendererBase<GridRenderStyleInfo>.RefreshCellUIElementsContent(VirtualizingCellsControl, CellUIElements, RowColumnIndex)
    CellRendererBase<GridRenderStyleInfo>.UnloadVisualsWhenScrolledOutOfView
    GridCellRendererBase.ActivateOptions
    GridCellRendererBase.AllowGridToFocus
    GridCellRendererBase.ApplyControlText(GridRenderStyleInfo, String)
    GridCellRendererBase.CellModel
    GridCellRendererBase.CellRowColumnIndex
    GridCellRendererBase.ColumnIndex
    GridCellRendererBase.ControlText
    GridCellRendererBase.ControlValue
    GridCellRendererBase.CurrentCell
    GridCellRendererBase.CurrentCellUIElement
    GridCellRendererBase.CurrentStyle
    GridCellRendererBase.CurrentStyleCopy
    GridCellRendererBase.EditorType
    GridCellRendererBase.EmptyRecycleBin()
    GridCellRendererBase.GetControlText(GridRenderStyleInfo)
    GridCellRendererBase.GetControlTextCore(GridRenderStyleInfo, Object)
    GridCellRendererBase.GetControlTextFromEditor()
    GridCellRendererBase.GetControlValue(GridRenderStyleInfo)
    GridCellRendererBase.GetControlValueFromEditor()
    GridCellRendererBase.GridControl
    GridCellRendererBase.HasControlText
    GridCellRendererBase.HasControlValue
    GridCellRendererBase.HasCurrentCellState
    GridCellRendererBase.IGridCellRenderer.RaiseConfirmChangesFailed()
    GridCellRendererBase.IGridCellRenderer.RaiseGridPreviewTextInput(TextCompositionEventArgs)
    GridCellRendererBase.IGridCellRenderer.RenderForPrinting(DrawingContext, RenderCellArgs, GridRenderStyleInfo)
    GridCellRendererBase.IGridCellRenderer.ShouldGridTryToHandlePreviewKeyDown(KeyEventArgs)
    GridCellRendererBase.InInitialize
    GridCellRendererBase.InSetControlText
    GridCellRendererBase.InSetControlValue
    GridCellRendererBase.IsControlTextShown
    GridCellRendererBase.IsCurrentCell(GridControlBase, RowColumnIndex)
    GridCellRendererBase.IsCurrentCell(GridRenderStyleInfo)
    GridCellRendererBase.IsCurrentCell(UIElement)
    GridCellRendererBase.IsDropDownable
    GridCellRendererBase.IsDroppedDown
    GridCellRendererBase.IsEditable
    GridCellRendererBase.IsFocusable
    GridCellRendererBase.IsFocused
    GridCellRendererBase.IsModifiable
    GridCellRendererBase.IsModified
    GridCellRendererBase.MouseDown(FrameworkElement, MouseControllerEventArgs)
    GridCellRendererBase.MoveCurrentHelper(FrameworkElement, MouseControllerEventArgs)
    GridCellRendererBase.NotifyCurrentCellChanged()
    GridCellRendererBase.NotifyCurrentCellChanging()
    GridCellRendererBase.OnActivated()
    GridCellRendererBase.OnActivateFailed()
    GridCellRendererBase.OnActivating()
    GridCellRendererBase.OnClipboardPaste(GridCutPasteEventArgs)
    GridCellRendererBase.OnClipboardPasted(GridCutPasteEventArgs)
    GridCellRendererBase.OnConfirmChangesFailed()
    GridCellRendererBase.OnCreateAutomationPeer()
    GridCellRendererBase.OnCreated()
    GridCellRendererBase.OnDeactivated()
    GridCellRendererBase.OnDeactivateFailed()
    GridCellRendererBase.OnDeactivating()
    GridCellRendererBase.OnEditingComplete()
    GridCellRendererBase.OnEnteredEditMode()
    GridCellRendererBase.OnGridPreviewTextInput(TextCompositionEventArgs)
    GridCellRendererBase.OnInitialize()
    GridCellRendererBase.OnRejectChanges()
    GridCellRendererBase.OnRenderForPrinting(DrawingContext, RenderCellArgs, GridRenderStyleInfo)
    GridCellRendererBase.OnResetFocus()
    GridCellRendererBase.OnSaveChanges()
    GridCellRendererBase.OnSetFocus()
    GridCellRendererBase.OnValidate()
    GridCellRendererBase.OnValidated()
    GridCellRendererBase.RaiseActivated()
    GridCellRendererBase.RaiseActivateFailed()
    GridCellRendererBase.RaiseActivating(GridControlBase, RowColumnIndex, GridActivateCurrentCellOptions)
    GridCellRendererBase.RaiseBeginEdit()
    GridCellRendererBase.RaiseClipboardPaste(GridCutPasteEventArgs)
    GridCellRendererBase.RaiseClipboardPasted(GridCutPasteEventArgs)
    GridCellRendererBase.RaiseCreated(GridCellModelBase)
    GridCellRendererBase.RaiseDeactivated()
    GridCellRendererBase.RaiseDeactivateFailed()
    GridCellRendererBase.RaiseDeactivating()
    GridCellRendererBase.RaiseEditingComplete()
    GridCellRendererBase.RaiseEndEdit()
    GridCellRendererBase.RaiseGridCellClick(Int32, Int32, MouseControllerEventArgs)
    GridCellRendererBase.RaiseGridPreviewMouseMove(RowColumnIndex, MouseEventArgs)
    GridCellRendererBase.RaiseInitialize(GridActivateCurrentCellOptions)
    GridCellRendererBase.RaiseRejectChanges()
    GridCellRendererBase.RaiseSaveChanges()
    GridCellRendererBase.RaiseStartEditing()
    GridCellRendererBase.RaiseValidate()
    GridCellRendererBase.RaiseValidated()
    GridCellRendererBase.RefreshContent()
    GridCellRendererBase.ResetControlText()
    GridCellRendererBase.ResetControlValue()
    GridCellRendererBase.ResetCurrentCellState()
    GridCellRendererBase.RowIndex
    GridCellRendererBase.ScrollInView()
    GridCellRendererBase.SetControlText(String)
    GridCellRendererBase.SetControlText(String, Boolean)
    GridCellRendererBase.SetControlValue(Object)
    GridCellRendererBase.SetCurrentCellState(GridControlBase, RowColumnIndex, GridActivateCurrentCellOptions)
    GridCellRendererBase.ShouldCurrentCellShowCellText()
    GridCellRendererBase.ShouldGridTryToHandlePreviewKeyDown(KeyEventArgs)
    GridCellRendererBase.StyleChanged(StyleChangedEventArgs)
    GridCellRendererBase.SupportsRenderOptimization
    GridCellRendererBase.UpdateCellRowColumnIndex(RowColumnIndex)
    GridCellRendererBase.UpdateCurrentStyle()
    GridCellRendererBase.ValidateControlText(String)
    GridCellRendererBase.ValidateControlValue(Object)
    NonFinalizeDisposable.Dispose()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.Windows.Controls.Grid
    Assembly: Syncfusion.Grid.Wpf.dll
    Syntax
    public abstract class GridVirtualizingCellRendererBase<T> : GridCellRendererBase, IGridCellRenderer, ICellRenderer, IHitTestSelectCells, IStyleChanged, IDisposable where T : FrameworkElement, new()
    Type Parameters
    Name Description
    T

    The type of the UIElement that should be placed inside cells

    Constructors

    GridVirtualizingCellRendererBase()

    Declaration
    protected GridVirtualizingCellRendererBase()

    Properties

    AllowRecycle

    Gets or sets a value indicating whether elements can be recycled when scrolled out of view. 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. The default value is false.

    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.

    AllowRecycleIfIsKeyboardFocusWithin

    When true, it allows to recycle the UI element if it contains the keyboard focus.

    Declaration
    public bool AllowRecycleIfIsKeyboardFocusWithin { get; set; }
    Property Value
    Type
    System.Boolean

    AllowTransparentBackground

    Gets or sets a value indicating whether the background of the UIElement visual placed in the cell can be set to System.Windows.Media.Brushes.Transparent. This is needed in order for the cells control to draw the cell background color behind the UIElement. The default value is true.

    Declaration
    public bool AllowTransparentBackground { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [allow transparent background]; otherwise, false.

    InInitializeContent

    Gets a value indicating whether InitializeContent was called.

    Declaration
    public bool InInitializeContent { get; }
    Property Value
    Type Description
    System.Boolean

    true if InitializeContent was called; otherwise, false.

    Methods

    ArrangeUIElement(ArrangeCellArgs, T, GridRenderStyleInfo)

    Arranges the UI element inside the cell rectangle.

    Declaration
    protected virtual void ArrangeUIElement(ArrangeCellArgs aca, T uiElement, GridRenderStyleInfo style)
    Parameters
    Type Name Description
    ArrangeCellArgs aca

    The arrange cell layout.

    T uiElement

    The UI element.

    GridRenderStyleInfo style

    The cell style.

    CreateRendererElement(T, GridRenderStyleInfo)

    Called to initialize the content of the cell when using the information from the cell style (value, text, behavior etc.). You must override this method in your derived class.

    Declaration
    public abstract void CreateRendererElement(T uiElement, GridRenderStyleInfo cellInfo)
    Parameters
    Type Name Description
    T uiElement

    The UI element.

    GridRenderStyleInfo cellInfo

    The cell style info.

    CreateUIElement(ArrangeCellArgs, GridRenderStyleInfo)

    Creates a new UIElement of type specified with the class type parameter.

    Declaration
    protected virtual T CreateUIElement(ArrangeCellArgs aca, GridRenderStyleInfo cellInfo)
    Parameters
    Type Name Description
    ArrangeCellArgs aca
    GridRenderStyleInfo cellInfo
    Returns
    Type Description
    T

    The UI element.

    Dispose(Boolean)

    This gets called when parent grid is unloaded. Unload all elements that were saved for later reuse.

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

    GetBounds(UIElement)

    Declaration
    public static Rect GetBounds(UIElement el)
    Parameters
    Type Name Description
    System.Windows.UIElement el
    Returns
    Type
    System.Windows.Rect

    GetUIElement(CellUIElements)

    Gets the UI element or null if the cell visuals do not have any UIElement visuals.

    Declaration
    public T GetUIElement(CellUIElements cellUIElements)
    Parameters
    Type Name Description
    CellUIElements cellUIElements

    The cell visuals.

    Returns
    Type Description
    T

    The UI element.

    InitializeContent(T, GridRenderStyleInfo)

    Called from OnArrange(ArrangeCellArgs, GridRenderStyleInfo) to initialize the content of the cell using the information from the cell style (value, text, behavior etc.). The method calls the virtual OnInitializeContent(T, GridRenderStyleInfo) which you should override in your derived class.

    Declaration
    public void InitializeContent(T uiElement, GridRenderStyleInfo cellInfo)
    Parameters
    Type Name Description
    T uiElement

    The UI element.

    GridRenderStyleInfo cellInfo

    The cell style info.

    InitializeDefaultProperties(T)

    Set Backgrounds, BorderThickness, Padding and IsEnabled properties.

    Declaration
    protected virtual void InitializeDefaultProperties(T uiElement)
    Parameters
    Type Name Description
    T uiElement

    The UI element.

    InvalidateMeasureRecursive(UIElement)

    Declaration
    protected void InvalidateMeasureRecursive(UIElement obj)
    Parameters
    Type Name Description
    System.Windows.UIElement obj

    OnArrange(ArrangeCellArgs, GridRenderStyleInfo)

    Called from Arrange(ArrangeCellArgs) to arrange the cells UIElement children. The method checks ShouldCreateVisuals and if this is true it will initialize the newly created UIElement with attached properties about CellRowColumnIndex, RenderCellInfo, CellRenderer, initialize its default properties with a call to InitializeDefaultProperties(T) and its cell specific content with a call to InitializeContent(T, GridRenderStyleInfo). The UIElement is arranged on the canvas with a call to ArrangeUIElement(ArrangeCellArgs, T, GridRenderStyleInfo).

    Declaration
    protected override void OnArrange(ArrangeCellArgs aca, GridRenderStyleInfo style)
    Parameters
    Type Name Description
    ArrangeCellArgs aca

    The arange cell layout information.

    GridRenderStyleInfo style

    The cell style info.

    Overrides
    Syncfusion.Windows.Controls.Cells.CellRendererBase<Syncfusion.Windows.Controls.Grid.GridRenderStyleInfo>.OnArrange(Syncfusion.Windows.Controls.Cells.ArrangeCellArgs, Syncfusion.Windows.Controls.Grid.GridRenderStyleInfo)

    OnElementArranged(UIElement, Rect)

    Declaration
    protected virtual void OnElementArranged(UIElement el, Rect rect)
    Parameters
    Type Name Description
    System.Windows.UIElement el
    System.Windows.Rect rect

    OnElementMeasured(UIElement, Size)

    Declaration
    protected virtual void OnElementMeasured(UIElement el, Size size)
    Parameters
    Type Name Description
    System.Windows.UIElement el
    System.Windows.Size size

    OnInitializeContent(T, GridRenderStyleInfo)

    Called to initialize the content of the cell when in edit using the information from the cell style (value, text, behavior etc.). You must override this method in your derived class.

    Declaration
    public abstract void OnInitializeContent(T uiElement, GridRenderStyleInfo cellInfo)
    Parameters
    Type Name Description
    T uiElement

    The UI element.

    GridRenderStyleInfo cellInfo

    The cell style info.

    OnPrepareUIElements(ArrangeCellArgs, List<UIElement>, ScrollControlChildFrame, GridRenderStyleInfo)

    Called from Arrange(ArrangeCellArgs) to prepare the cells UIElement children. VirtualizingCellRendererBase overrides this method and creates new UIElements and wires them with the parent cells control.

    Declaration
    protected override void OnPrepareUIElements(ArrangeCellArgs aca, List<UIElement> uiElements, ScrollControlChildFrame canvas, GridRenderStyleInfo cellInfo)
    Parameters
    Type Name Description
    ArrangeCellArgs aca

    The arange cell layout information.

    System.Collections.Generic.List<System.Windows.UIElement> uiElements

    The UI elements.

    ScrollControlChildFrame canvas

    The canvas to which any UIElement elements should be added.

    GridRenderStyleInfo cellInfo

    The cell style info.

    Overrides
    Syncfusion.Windows.Controls.Cells.CellRendererBase<Syncfusion.Windows.Controls.Grid.GridRenderStyleInfo>.OnPrepareUIElements(Syncfusion.Windows.Controls.Cells.ArrangeCellArgs, System.Collections.Generic.List<System.Windows.UIElement>, Syncfusion.Windows.Controls.Scroll.ScrollControlChildFrame, Syncfusion.Windows.Controls.Grid.GridRenderStyleInfo)

    OnUnloadUIElements(VirtualizingCellsControl, RowColumnIndex, CellUIElements)

    Called from UnloadUIElements(VirtualizingCellsControl, RowColumnIndex, CellUIElements) after a cell is scrolled out of view. VirtualizingCellRendererBase overrides this method and creates either removes the cell renderer visuals from the parent canvas or hide them and reuse it later in same canvas depending on whether AllowRecycle was set.

    Declaration
    protected override sealed void OnUnloadUIElements(VirtualizingCellsControl host, RowColumnIndex cellRowColumnIndex, CellUIElements visuals)
    Parameters
    Type Name Description
    VirtualizingCellsControl host

    The host.

    RowColumnIndex cellRowColumnIndex

    Index of the cell row column.

    CellUIElements visuals

    The visuals.

    Overrides
    Syncfusion.Windows.Controls.Cells.CellRendererBase<Syncfusion.Windows.Controls.Grid.GridRenderStyleInfo>.OnUnloadUIElements(Syncfusion.Windows.Controls.Cells.VirtualizingCellsControl, Syncfusion.Windows.Controls.Cells.RowColumnIndex, Syncfusion.Windows.Controls.Cells.CellUIElements)

    OnUnwireUIElement(T)

    Unwire previously wired events from uiElement.

    Declaration
    protected virtual void OnUnwireUIElement(T uiElement)
    Parameters
    Type Name Description
    T uiElement

    OnWireUIElement(T)

    Wire events from uiElement

    Declaration
    protected virtual void OnWireUIElement(T uiElement)
    Parameters
    Type Name Description
    T uiElement

    SetBounds(UIElement, Rect)

    Helper method which arranges an UI element by setting the Left, Top, Right, Bottom attached properties and its Width, Height, MaxWidth and MaxHeight properties. The visibility is set to Visibility.Visible and the elements Measure and Arrange methods are called.

    Declaration
    protected void SetBounds(UIElement el, Rect rect)
    Parameters
    Type Name Description
    System.Windows.UIElement el

    The element.

    System.Windows.Rect rect

    The rectangle.

    SetBounds(UIElement, Rect, Boolean, Boolean)

    Helper method which arranges an UI element by setting the Left, Top, Right, Bottom attached properties and its Width, Height, MaxWidth and MaxHeight properties. The visibility is set to Visibility.Visible and the elements Measure and Arrange methods are called.

    Declaration
    protected void SetBounds(UIElement el, Rect rect, bool forceMeasure, bool forceArrange)
    Parameters
    Type Name Description
    System.Windows.UIElement el

    The element.

    System.Windows.Rect rect

    The rectangle.

    System.Boolean forceMeasure
    System.Boolean forceArrange

    Implements

    IGridCellRenderer
    ICellRenderer
    IHitTestSelectCells
    IStyleChanged
    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved