Class VirtualizingCellsControl
VirtualizingCellsControl is an abstract base class which can be used as a base class for any control with the purpose of displaying cells in scrollable rows and columns with built-in virtualization of visual elements inside the cells.
VirtualizingCellsControl queries cell contents with the GetRenderCellInfo(DependencyObject) method which returns a IRenderCellInfo object. Each cell is associated with a ICellRenderer object which provides methods for measuring, arranging and drawing contents of a cell. The VirtualizingCellsControl implements the OnArrangeContent(Size) and OnRender(DrawingContext) methods. Within implementation of the OnArrangeContent method each cells UIElement children are placed on the controls area. A cell renderer can also be without any UIElement children and instead draw all its contents directly to the DrawingContext of the VirtualizingCellsControl when the OnRender(DrawingContext) method is executed. For a cell renderer it is also possible to do both: Arrange UIElements on the controls area and draw additional contents in its render area. There are also various optimization techniques that can be implemented with the renderer and are discussed in the ICellRenderer overview.
VirtualizingCellsControl provides a few standard features that can be utilized by derived grid or tree controls such as the "Covered Cell" feature (see CoveredCellsProvider), the "SpanBackground" ( CellSpanBackgroundsProvider) feature, support for MouseControllers (MouseControllerDispatcher), create an UIElement on demand when hovering mouse over cell, cell borders and methods that convert from display coordinates to cell coordinates and vice versa.
The virtualization of UIElement children of cell renderers is implemented in the arrange cells code. At the time a cell is placed the cell renderer is called to create and intialize the UIElement children. When a cell is scrolled out of view the cell renderer is called to unload the UIElement children. A cell renderer can decide whether to unload a UIElement, keep it alive or move it to a recycle bin and reuse it later. The main logic of this code is implemented by the VirtualizingCellRendererBase<T> class which contains more detailed discussion about this feature.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Controls.Cells
Assembly: Syncfusion.GridCommon.WPF.dll
Syntax
public abstract class VirtualizingCellsControl : ScrollAxisControl, IScrollBarProvider, IScrollInfo, IDisposable
Constructors
VirtualizingCellsControl()
Initializes a new instance of the VirtualizingCellsControl class.
Declaration
public VirtualizingCellsControl()
Fields
ArrangeCellArgsProperty
Declaration
public static readonly DependencyProperty ArrangeCellArgsProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
CellRendererProperty
Returns the cell renderer of an UIElement inside a cell. When the editor inside a cell has children and you query this attached property for a child it will query the top-most parent element of the cell renderer for the value of the property.
Declaration
public static readonly DependencyProperty CellRendererProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
CellRowColumnIndexProperty
Returns the RowColumnIndex of an UIElement inside a cell. When the editor inside a cell has children and you query this attached property for a child it will query the top-most parent element of the cell renderer for the value of the property.
Declaration
public static readonly DependencyProperty CellRowColumnIndexProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
CellsControlProperty
Returns the VirtualizingCellsControl of an UIElement inside a cell. When the editor inside a cell has children and you query this for a child it will query the top-most parent element of the cell renderer for the value of the property.
Declaration
public static readonly DependencyProperty CellsControlProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
CellUIElementProperty
Returns the top-most parent element of the cell renderer When the editor inside a cell has children and you query this attached property for a child it will query the top-most parent element of the cell renderer for the value of the property.
Declaration
public static readonly DependencyProperty CellUIElementProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
floatcellran
Contains the range details of Overlapping cells
Declaration
protected Dictionary<RowColumnIndex, int> floatcellran
Field Value
Type |
---|
System.Collections.Generic.Dictionary<RowColumnIndex, System.Int32> |
RenderCellInfoProperty
Returns the IRenderCellInfo of an UIElement inside a cell. When the editor inside a cell has children and you query this attached property for a child it will query the top-most parent element of the cell renderer for the value of the property.
Declaration
public static readonly DependencyProperty RenderCellInfoProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowGridLinesProperty
Declaration
public static readonly DependencyProperty ShowGridLinesProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
AllowBorderRounding
Gets or sets whether border lines have to be rounded off.
Declaration
public bool AllowBorderRounding { get; set; }
Property Value
Type |
---|
System.Boolean |
ArrangedCellUIElements
Provides routines for managing cells visuals (aka UIElement children) of rendered cells that have been associated with one or more UIElement visuals.
Declaration
public ArrangedCellUIElementsManager ArrangedCellUIElements { get; }
Property Value
Type |
---|
ArrangedCellUIElementsManager |
CellSpanBackgroundsProvider
Gets or sets the cell span backgrounds provider. A spanned background allows one cell to draw its background across multiple neighbouring cells. The neighbouring cells are still individual cells with their own editor but all share the cell backgound. You can example attach a image to one cell and draw it across multiple cells.
Declaration
public ICellSpanBackgroundsProvider CellSpanBackgroundsProvider { get; set; }
Property Value
Type | Description |
---|---|
ICellSpanBackgroundsProvider | The cell span backgrounds provider. |
ClearVisualsCacheWhenUnloaded
Gets or sets whether the control should clear out cache with visuals, arrange ui elemnts and cell styles when the control is unloaded. The default setting is false.
Declaration
public bool ClearVisualsCacheWhenUnloaded { get; set; }
Property Value
Type |
---|
System.Boolean |
CoveredCellsProvider
Gets or sets the covered cells provider. A covered cell is a cell that spans multiple neighbouring cells.
Declaration
public ICoveredCellsProvider CoveredCellsProvider { get; set; }
Property Value
Type | Description |
---|---|
ICoveredCellsProvider | The covered cells provider. |
EnableFrameArrangement
Gets or sets whether frame arrangement should happen or not
Declaration
public bool EnableFrameArrangement { get; set; }
Property Value
Type |
---|
System.Boolean |
EnableRenderCellDrawingVisuals
Gets or sets a value indicating whether the VirtualizingCellsControl should render cells using a DrawingVisual for each cell. If false the control will render all cells to the same drawing context instead (which will be slower).
Declaration
public bool EnableRenderCellDrawingVisuals { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IndividualCellBackgroundsToDraw
Declaration
protected HashSet<RowColumnIndex> IndividualCellBackgroundsToDraw { get; set; }
Property Value
Type |
---|
System.Collections.Generic.HashSet<RowColumnIndex> |
IsInArrageCell
Gets a value indicating whether OnArrangeCell(ArrangeCellArgs) is called.
Declaration
public bool IsInArrageCell { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsInOnRender
Declaration
public bool IsInOnRender { get; }
Property Value
Type |
---|
System.Boolean |
MouseControllerDispatcher
MouseControllerDispatcher coordinates mouse events among competing mouse controllers. Based on the position of the mouse and context of the control every registered controller's HitTest method is called to determine the best controller for the following mouse action. This controller will then receive mouse events.
Declaration
public CellMouseControllerDispatcher MouseControllerDispatcher { get; }
Property Value
Type |
---|
CellMouseControllerDispatcher |
Remarks
See CellMouseControllerDispatcher for more information.
OverlappingCellsProvider
Declaration
public IOverlappingCellProvider OverlappingCellsProvider { get; set; }
Property Value
Type |
---|
IOverlappingCellProvider |
RenderedCellVisuals
Gets the manager object for DrawingVisuals of visible cells.
Declaration
public RenderedCellsManager RenderedCellVisuals { get; }
Property Value
Type | Description |
---|---|
RenderedCellsManager | The rendered cell visuals. |
ShowGridLines
Declaration
public bool ShowGridLines { get; set; }
Property Value
Type |
---|
System.Boolean |
UseGuidelineSetToRenderBackground
Declaration
public bool UseGuidelineSetToRenderBackground { get; set; }
Property Value
Type |
---|
System.Boolean |
UseGuidelineSetToRenderBorder
Use guide lines to adjusting rendered border to a device pixel grid.
Declaration
public bool UseGuidelineSetToRenderBorder { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
AdjustCoveredCellRowColumnIndex(RowColumnIndex)
Adjusts the index of the cell index if inside a covered cell to return the top and left index of the covered cell. If not inside a covered cell returns the original cell index.
Declaration
public RowColumnIndex AdjustCoveredCellRowColumnIndex(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
Returns
Type |
---|
RowColumnIndex |
ArrangeCellBorders(Size)
Calculates Cell Borders combining borders of neighbouring cells with same value - they will be rendered later in OnRender.
Declaration
protected virtual void ArrangeCellBorders(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize |
ArrangeCellSpanBackgrounds(Size)
Arranges the cell span backgrounds.
Declaration
protected virtual void ArrangeCellSpanBackgrounds(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize | Size of the arrange. |
ArrangeCellUIElements(Size)
Arranges the cells row by row. For each cell the virtual OnArrangeCell(ArrangeCellArgs) method is called. OnArrangeCell gets the ICellRenderer for a cell and calls its Arrange(ArrangeCellArgs) method.
The method also implements the virtualization of UIElement children of cell renderers. It create new UIElement objects for cells scrolled into view or unload UIElements for cells scrolled out of view. If a UIElement has focus whenscrolled out of view it will be kept alive and not unloaded.
Declaration
protected virtual void ArrangeCellUIElements(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize |
ArrangeCombinedCellBackgrounds(Size)
Combines cells with same cell backround to reduce number of drawing operations. The cell background will later be rendered when OnRender(DrawingContext) is called.
Declaration
protected virtual void ArrangeCombinedCellBackgrounds(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize | Size of the arrange. |
ArrangeCoveredCells(Size)
Arranges the covered cells.
Declaration
protected virtual void ArrangeCoveredCells(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize | Size of the arrange. |
ArrangeOverlappingCells(Size)
Declaration
protected virtual void ArrangeOverlappingCells(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize |
CanCombineCellBorder(IRenderCellInfo, IRenderCellInfo, Pen, Pen, CellBorderSide)
Declaration
protected virtual bool CanCombineCellBorder(IRenderCellInfo previousCellInfo, IRenderCellInfo ci, Pen previousBorder, Pen border, CellBorderSide borderSide)
Parameters
Type | Name | Description |
---|---|---|
IRenderCellInfo | previousCellInfo | |
IRenderCellInfo | ci | |
System.Windows.Media.Pen | previousBorder | |
System.Windows.Media.Pen | border | |
CellBorderSide | borderSide |
Returns
Type |
---|
System.Boolean |
CanDrawHorizontalLineFirst()
Declaration
protected virtual bool CanDrawHorizontalLineFirst()
Returns
Type |
---|
System.Boolean |
CellSpanToClippedVisibleRect(CellSpanInfo)
Declaration
public Rect CellSpanToClippedVisibleRect(CellSpanInfo rg)
Parameters
Type | Name | Description |
---|---|---|
CellSpanInfo | rg |
Returns
Type |
---|
System.Windows.Rect |
CellSpanToRect(ScrollAxisRegion, ScrollAxisRegion, CellSpanInfo)
Returns the rectangle for a cell span background clipped by the boundaries of the given row and column region.
Declaration
public Rect CellSpanToRect(ScrollAxisRegion rowRegion, ScrollAxisRegion columnRegion, CellSpanInfo range)
Parameters
Type | Name | Description |
---|---|---|
ScrollAxisRegion | rowRegion | The row region. |
ScrollAxisRegion | columnRegion | The column region. |
CellSpanInfo | range | The cell span background range. |
Returns
Type |
---|
System.Windows.Rect |
CreateScrollControlChildFrame()
Creates the scroll control child frame object.
Declaration
protected override ScrollControlChildFrame CreateScrollControlChildFrame()
Returns
Type |
---|
ScrollControlChildFrame |
Overrides
DelayedCreateCellUIElements(RowColumnIndex)
Determine if cell at given cells row and column index is associated with UIElement. If not, check if UIElement can be created.
Declaration
public bool DelayedCreateCellUIElements(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
Returns
Type |
---|
System.Boolean |
Dispose(Boolean)
Declaration
public override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
EraseRenderedCell(RowColumnIndex, Rect)
Remove previously rendered cell from the ForegroundFrame frame. This is needed when a cells UIElement where created because the previous rendering (without UIElements being created like in an optimized TextBox renderer) would otherwise draw over the new arranged elements.
Declaration
public void EraseRenderedCell(RowColumnIndex cellRowColumnIndex, Rect cellRect)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | The cells row and column index. |
System.Windows.Rect | cellRect | The cells bounds. |
GetArrangeCellArgs(DependencyObject)
Declaration
public static ArrangeCellArgs GetArrangeCellArgs(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo |
Returns
Type |
---|
ArrangeCellArgs |
GetCellBackground(IRenderCellInfo, Boolean)
Gets the cell background for a cell from the IRenderCellInfo cell style.
Declaration
protected virtual Brush GetCellBackground(IRenderCellInfo ci, bool combineBackgrounds)
Parameters
Type | Name | Description |
---|---|---|
IRenderCellInfo | ci | The cell style. |
System.Boolean | combineBackgrounds | if set to |
Returns
Type |
---|
System.Windows.Media.Brush |
GetCellBorder(IRenderCellInfo, CellBorderSide)
Gets the cell border from the given cell style.
Declaration
protected virtual Pen GetCellBorder(IRenderCellInfo ci, CellBorderSide borderSide)
Parameters
Type | Name | Description |
---|---|---|
IRenderCellInfo | ci | The cell style. |
CellBorderSide | borderSide | The border side. |
Returns
Type |
---|
System.Windows.Media.Pen |
GetCellRenderer(IRenderCellInfo)
Gets the cell renderer from a render cell style.
Declaration
protected abstract ICellRenderer GetCellRenderer(IRenderCellInfo cellInfo)
Parameters
Type | Name | Description |
---|---|---|
IRenderCellInfo | cellInfo | The render cell style. |
Returns
Type |
---|
ICellRenderer |
GetCellRenderer(DependencyObject)
Gets the CellRendererProperty dependency property value.
Declaration
public static ICellRenderer GetCellRenderer(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be queried for the effective value of the dependency property. |
Returns
Type | Description |
---|---|
ICellRenderer | Returns the effective value for the given instance. |
GetCellRendererParentControl(DependencyObject)
Declaration
public static VirtualizingCellsControl GetCellRendererParentControl(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo |
Returns
Type |
---|
VirtualizingCellsControl |
GetCellRowColumnIndex(DependencyObject)
Gets the CellRowColumnIndexProperty attached dependency property value.
Declaration
public static RowColumnIndex GetCellRowColumnIndex(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be queried for the effective value of the dependency property. |
Returns
Type | Description |
---|---|
RowColumnIndex | Returns the effective value for the given instance. |
GetCellsControl(DependencyObject)
Gets the CellsControlProperty attached dependency property value.
Declaration
public static VirtualizingCellsControl GetCellsControl(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be queried for the effective value of the dependency property. |
Returns
Type | Description |
---|---|
VirtualizingCellsControl | Returns the effective value for the given instance. |
GetCellSpanBackgrounds(RowColumnIndex)
Gets the cell span backgrounds from the CellSpanBackgroundsProvider that includes the specified cells row and column index.
Declaration
public List<CellSpanBackgroundInfo> GetCellSpanBackgrounds(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | The pos. |
Returns
Type |
---|
System.Collections.Generic.List<CellSpanBackgroundInfo> |
GetCellSpanBackgrounds(Int32, Int32)
Gets the cell span backgrounds from the CellSpanBackgroundsProvider that include the specified cells row and column index.
Declaration
public List<CellSpanBackgroundInfo> GetCellSpanBackgrounds(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
Returns
Type |
---|
System.Collections.Generic.List<CellSpanBackgroundInfo> |
GetCellUIElement(DependencyObject)
Gets the CellUIElementProperty attached dependency property value.
Declaration
public static UIElement GetCellUIElement(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be queried for the effective value of the dependency property. |
Returns
Type | Description |
---|---|
System.Windows.UIElement | Returns the effective value for the given instance. |
GetCellUIElements(RowColumnIndex)
Gets the cell visuals for a cell.
Declaration
public CellUIElements GetCellUIElements(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
Returns
Type |
---|
CellUIElements |
GetCellUIElements(Int32, Int32)
Gets the cell visuals for a cell.
Declaration
public CellUIElements GetCellUIElements(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
Returns
Type |
---|
CellUIElements |
GetCoveredCell(RowColumnIndex)
Gets a covered cell from the CoveredCellsProvider that includes the specified cells row and column index.
Declaration
public CoveredCellInfo GetCoveredCell(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | The cells row and column index. |
Returns
Type |
---|
CoveredCellInfo |
GetCoveredCell(Int32, Int32)
Gets a covered cell from the CoveredCellsProvider that includes the specified cells row and column index.
Declaration
public CoveredCellInfo GetCoveredCell(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
Returns
Type |
---|
CoveredCellInfo |
GetHasFocusWithin(UIElement)
Declaration
public static bool GetHasFocusWithin(UIElement el)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.UIElement | el |
Returns
Type |
---|
System.Boolean |
GetOverlappingCell(RowColumnIndex)
Declaration
public OverlappingCellInfo GetOverlappingCell(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex |
Returns
Type |
---|
OverlappingCellInfo |
GetOverlappingCell(Int32, Int32)
Declaration
public OverlappingCellInfo GetOverlappingCell(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | |
System.Int32 | columnIndex |
Returns
Type |
---|
OverlappingCellInfo |
GetRenderCellInfo(Int32, Int32)
Gets the render cell style for a cell. VirtualizingCellsControl solely relies on the IRenderCellInfo for drawing and renderer information of a cell. Concrete implementations of this interface such as GridRenderStyleInfo or TreeRenderStyleInfo can add support for additional domain specific properties.
Declaration
protected abstract IRenderCellInfo GetRenderCellInfo(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
Returns
Type |
---|
IRenderCellInfo |
GetRenderCellInfo(DependencyObject)
Gets the RenderCellInfoProperty attached dependency property value.
Declaration
public static IRenderCellInfo GetRenderCellInfo(DependencyObject dpo)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be queried for the effective value of the dependency property. |
Returns
Type | Description |
---|---|
IRenderCellInfo | Returns the effective value for the given instance. |
GetVisibleCoveredCell(VisibleLineInfo, VisibleLineInfo)
Declaration
protected VisibleCoveredCellInfo GetVisibleCoveredCell(VisibleLineInfo visibleRow, VisibleLineInfo visibleColumn)
Parameters
Type | Name | Description |
---|---|---|
VisibleLineInfo | visibleRow | |
VisibleLineInfo | visibleColumn |
Returns
Type |
---|
VisibleCoveredCellInfo |
GetVisibleOverlappingCell(VisibleLineInfo, VisibleLineInfo)
Declaration
protected VisibleOverlappingCellInfo GetVisibleOverlappingCell(VisibleLineInfo visibleRow, VisibleLineInfo visibleColumn)
Parameters
Type | Name | Description |
---|---|---|
VisibleLineInfo | visibleRow | |
VisibleLineInfo | visibleColumn |
Returns
Type |
---|
VisibleOverlappingCellInfo |
GetVisibleRowAndColumn(RowColumnIndex, out VisibleLineInfo, out VisibleLineInfo)
Gets the visible row and visible column for a given cell which can also be a covered cell.
Declaration
public void GetVisibleRowAndColumn(RowColumnIndex cellRowColumnIndex, out VisibleLineInfo visibleRow, out VisibleLineInfo visibleColumn)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
VisibleLineInfo | visibleRow | The visible row. |
VisibleLineInfo | visibleColumn | The visible column. |
InvalidateCell(CellSpanInfoBase)
Marks the visuals for a range of cells to be reinitialized with a call to RefreshCellUIElementsContent(RowColumnIndex) next time OnRender is called. Override this method to clear out additional cached information for the cell such as render style information.
Declaration
public virtual void InvalidateCell(CellSpanInfoBase span)
Parameters
Type | Name | Description |
---|---|---|
CellSpanInfoBase | span | The range of cells. |
InvalidateCell(CellSpanInfoBase, Boolean)
Declaration
public virtual void InvalidateCell(CellSpanInfoBase span, bool dirtycelluielemet)
Parameters
Type | Name | Description |
---|---|---|
CellSpanInfoBase | span | |
System.Boolean | dirtycelluielemet |
InvalidateCell(RowColumnIndex)
Marks the visuals for a single cell to be reinitialized with a call to RefreshCellUIElementsContent(RowColumnIndex) next time OnRender is called. Override this method to clear out additional cached information for the cell such as render style information.
Declaration
public virtual void InvalidateCell(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
InvalidateCellBackground(RowColumnIndex)
Invalidates the cell background. The cells control combines the background of neighbouring cells in the OnArrangeContent(Size) method and reuses this information whenever the cells control is control is rendered without rearranging contents (when you specify false as paramater to the InvalidateVisual(Boolean) method). Call this method to ensure that background for this individual cell is requeried next time the cells control is rendered.
Declaration
public void InvalidateCellBackground(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
InvalidateCellBackground(Int32, Int32)
Invalidates the cell background. The cells control combines the background of neighbouring cells in the OnArrangeContent(Size) method and reuses this information whenever the cells control is control is rendered without rearranging contents (when you specify false as paramater to the InvalidateVisual(Boolean) method). Call this method to ensure that background for this individual cell is requeried next time the cells control is rendered.
Declaration
public void InvalidateCellBackground(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
InvalidateCellBackground(Int32, Int32, Boolean)
Declaration
public void InvalidateCellBackground(int rowIndex, int columnIndex, bool useIndividualCells)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | |
System.Int32 | columnIndex | |
System.Boolean | useIndividualCells |
InvalidateCellBorder(RowColumnIndex)
Invalidates the cell border. This will make sure the cells control will rerender cell borders next time OnRender is called.
Declaration
public void InvalidateCellBorder(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
InvalidateCellBorder(Int32, Int32)
Invalidates the cell border. This will make sure the cells control will rerender cell borders next time OnRender is called.
Declaration
public void InvalidateCellBorder(int rowIndex, int columnIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | rowIndex | Index of the row. |
System.Int32 | columnIndex | Index of the column. |
InvalidateCellRenderStyleBackground(RowColumnIndex)
The method currently does not do anything. It is a place holder to be able to invalidate the blinking of a cell without touching the cell content, but with the current implementation this is actually not needed. For now we left this method in case we change the implementation how blinking cells are drawn.
Declaration
public void InvalidateCellRenderStyleBackground(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex |
InvalidateCells()
Calls UnloadArrangedCells().
Declaration
public void InvalidateCells()
MeasureOverride(Size)
Returns the maximum height and width of the cells control. If pixel scrolling is enabled for a axis the method queries the TotalExtent value of the PixelScrollAxis.
Declaration
protected override Size MeasureOverride(Size constraint)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | constraint | The maximum size limit for the control. |
Returns
Type | Description |
---|---|
System.Windows.Size | The maximum size of the control. |
Overrides
OnArrangeCell(ArrangeCellArgs)
OnArrangeCell gets the ICellRenderer for a cell and calls its Arrange(ArrangeCellArgs) method. The method also adjust the CellRect and subtracts the border margins from the rectangle.
Declaration
protected virtual void OnArrangeCell(ArrangeCellArgs aca)
Parameters
Type | Name | Description |
---|---|---|
ArrangeCellArgs | aca | The cell layout information. |
OnArrangeContent(Size)
Arranges the cells row by row with the ArrangeCellUIElements(Size) method. For each cell the virtual OnArrangeCell(ArrangeCellArgs) method is called. OnArrangeCell gets the ICellRenderer for a cell and calls its Arrange(ArrangeCellArgs) method.
ArrangeCellUIElements creates new UIElements for cells scrolled into view or unload UIElements for cells scrolled out of view.
OnArrangeContent also arranges covered cells, spaned backgrounds, cell borders and combines cells with same cell backround (ArrangeCombinedCellBackgrounds(Size)) to reduce number of drawing operations.
Declaration
protected override void OnArrangeContent(Size arrangeSize)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize |
Overrides
OnArrangeOverride(Size, ref Boolean)
Declaration
protected override Size OnArrangeOverride(Size arrangeSize, ref bool isArrangeDirty)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Size | arrangeSize | |
System.Boolean | isArrangeDirty |
Returns
Type |
---|
System.Windows.Size |
Overrides
OnInvalidated(Boolean)
Called when the InvalidateVisual(Boolean) method was called.
Declaration
protected override void OnInvalidated(bool isArrangeDirty)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isArrangeDirty | if set to |
Overrides
OnKeyDown(KeyEventArgs)
Implements handling for the KeyDown event. When a user presses scroll or arrow keys this method will scroll the control.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnPreviewKeyDown(KeyEventArgs)
Implements handling for the PreviewKeyDown event. When a user pressed Escape it will call CancelMode of the MouseControllerDispatcher.
Declaration
protected override void OnPreviewKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs that contains the event data. |
OnRender(DrawingContext)
Implements the render logic for the cells control. The method first renders cell backgrounds, then the individual cells for each cell calling OnRenderCell(DrawingContext, RenderCellArgs), then covered cells and finally the cell borders.
Cell Backgrounds are rendered to the BackgroundFrame behind cells. Cell Borders are rendered to the ForegroundFrame in front of cells. Cells are rendered row by row to the ForegroundFrame but they will be drawn in code before the cell borders are rendered and thus appear behind cell borders. The rendering of cells also places the rendered contents of a cell in front of the contents of placed UIElement children of cell renderers.
The UIElement children of cellrenderers are placed within the frames provided by the ScrollControl base class. (see OnArrangeContent(Size).
Declaration
protected override void OnRender(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
Overrides
OnRenderBorder(DrawingContext, Rect, Rect, CellBorderSide, Pen)
Declaration
protected virtual void OnRenderBorder(DrawingContext dc, Rect cellRect, Rect clipRect, CellBorderSide borderSide, Pen pen)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
System.Windows.Rect | cellRect | |
System.Windows.Rect | clipRect | |
CellBorderSide | borderSide | |
System.Windows.Media.Pen | pen |
OnRenderCell(DrawingContext, RenderCellArgs)
Called to render a cell (both covered and non-covered). The default implementation of this method gets the ICellRenderer for a cell and calls its Render(DrawingContext, RenderCellArgs) method. If the cells background was not drawn yet the method gets the background with GetCellBackground(IRenderCellInfo, Boolean) and draws it to the drawing context. The method also adjust the CellRect and subtracts the border margins from the rectangle.
Declaration
protected virtual void OnRenderCell(DrawingContext dc, RenderCellArgs rca)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
RenderCellArgs | rca | The cell layout information. |
OnRenderCellBackground(DrawingContext, RenderCellArgs)
Declaration
protected virtual void OnRenderCellBackground(DrawingContext dc, RenderCellArgs rca)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
RenderCellArgs | rca |
OnRenderCellBackground(DrawingContext, VisibleCoveredCellInfo, RenderCellArgs)
Called to render the background of a cell to a drawing context. The method first checks if the background of the cell is different from the default cell background and only then draws the background for all cell in a covered cell range.
Declaration
protected virtual void OnRenderCellBackground(DrawingContext dc, VisibleCoveredCellInfo ccSpan, RenderCellArgs rca)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The dc. |
VisibleCoveredCellInfo | ccSpan | CoveredCellInfo. |
RenderCellArgs | rca | The rca. |
OnRenderCellBackground(DrawingContext, VisibleOverlappingCellInfo, RenderCellArgs)
Declaration
protected virtual void OnRenderCellBackground(DrawingContext dc, VisibleOverlappingCellInfo icSpan, RenderCellArgs rca)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
VisibleOverlappingCellInfo | icSpan | |
RenderCellArgs | rca |
OnScrollLayoutChanged()
Called when settings of ScrollRows or ScrollColumns were changed.
Declaration
protected override void OnScrollLayoutChanged()
Overrides
OnShowGridLinesChanged(DependencyPropertyChangedEventArgs)
Declaration
protected virtual void OnShowGridLinesChanged(DependencyPropertyChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | args |
OnUnloaded(RoutedEventArgs)
This virtual method is called from the System.Windows.FrameworkElement.Unloaded event handler.
Override this method to clear cached settings (e.g. rendered styles, visibility of rows) when the control was unloaded. Do not unwire events here since a control can be unloaded and loaded multiple times during its lifetime.
Declaration
protected override void OnUnloaded(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.RoutedEventArgs | e | The System.Windows.RoutedEventArgs instance containing the event data. |
Overrides
PointToCellRowColumnIndex(MouseEventArgs, Boolean)
Determines the cell under the mouse location.
Declaration
public RowColumnIndex PointToCellRowColumnIndex(MouseEventArgs e, bool adjustForCoveredCells)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | The System.Windows.Input.MouseEventArgs instance containing the event data. |
System.Boolean | adjustForCoveredCells | if set to |
Returns
Type | Description |
---|---|
RowColumnIndex | The cells row and column index under the mouse location. |
PointToCellRowColumnIndex(Point, Boolean)
Determines the cell under the mouse location.
Declaration
public RowColumnIndex PointToCellRowColumnIndex(Point p, bool adjustForCoveredCells)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Point | p | The point in client coordinates. |
System.Boolean | adjustForCoveredCells | if set to |
Returns
Type | Description |
---|---|
RowColumnIndex | The cells row and column index under the mouse location. |
PrepareCellUIElements(ArrangeCellArgs, List<UIElement>, ScrollControlChildFrame)
Prepares the cells UIElement children. The method gets the ICellRenderer for a cell and calls its PrepareUIElements(ArrangeCellArgs, List<UIElement>, ScrollControlChildFrame) method.
Declaration
protected virtual void PrepareCellUIElements(ArrangeCellArgs aca, List<UIElement> uiElements, ScrollControlChildFrame canvas)
Parameters
Type | Name | Description |
---|---|---|
ArrangeCellArgs | aca | The cell layout information. |
System.Collections.Generic.List<System.Windows.UIElement> | uiElements | The UI elements. |
ScrollControlChildFrame | canvas | The child frame in the scroll control. |
PushClip(DrawingContext, Rect)
A helper method that createa a System.Windows.Media.RectangleGeometry, calls Freeze and System.Windows.Media.DrawingContext.PushClip(System.Windows.Media.Geometry)
Declaration
protected void PushClip(DrawingContext dc, Rect clipRect)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The dc. |
System.Windows.Rect | clipRect | The clip rect. |
PushClip(DrawingContext, Rect, Rect)
A helper method that creates a System.Windows.Media.CombinedGeometry consisting of a System.Windows.Media.RectangleGeometry which excludes the given excludeRect, calls Freeze and System.Windows.Media.DrawingContext.PushClip(System.Windows.Media.Geometry)
Declaration
protected void PushClip(DrawingContext dc, Rect clipRect, Rect excludeRect)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The dc. |
System.Windows.Rect | clipRect | The clip rect. |
System.Windows.Rect | excludeRect | The exclude rect. |
ReArrangeCoveredCells(VirtualizingCellsControl)
Force and Rearrange the CoveredCells in the View
Declaration
public static void ReArrangeCoveredCells(VirtualizingCellsControl virtualizingCellsControl)
Parameters
Type | Name | Description |
---|---|---|
VirtualizingCellsControl | virtualizingCellsControl |
Remarks
While adding coveredcells in QueryCellInfo , need to call this method to refesh the Covered Cells Layout
RefreshCellUIElementsContent(RowColumnIndex)
Determine if cell at given cells row and column index is associated with UIElement. If yes, reintialize the cells UIElement with a call to OnArrangeCell(ArrangeCellArgs). OnArrangeCell gets the ICellRenderer for a cell and calls its Arrange(ArrangeCellArgs) method. This usually is called as a response to an earlier InvalidateCell(RowColumnIndex) call.
Declaration
public void RefreshCellUIElementsContent(RowColumnIndex cellRowColumnIndex)
Parameters
Type | Name | Description |
---|---|---|
RowColumnIndex | cellRowColumnIndex | Index of the cell row column. |
RenderBackgrounds(DrawingContext)
Renders the backgrounds of cells including background of normal cells, spanned background cells and covered cells.
Declaration
protected virtual void RenderBackgrounds(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
RenderCell(DrawingContext, RenderCellArgs)
Declaration
protected void RenderCell(DrawingContext dc, RenderCellArgs rca)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | |
RenderCellArgs | rca |
RenderCellBorders(DrawingContext)
Renders the cell borders.
Declaration
protected virtual void RenderCellBorders(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
RenderCells(DrawingContext)
Renders the cells row by row. For each row the virtual RenderRow(DrawingContext, VisibleLineInfo, Point) method is called which then calls OnRenderCell(DrawingContext, RenderCellArgs) for each cell. OnRenderCell gets the ICellRenderer for a cell and calls its Render(DrawingContext, RenderCellArgs) method.
Declaration
protected virtual void RenderCells(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
RenderCoveredCells(DrawingContext)
Renders the covered cells.
Declaration
protected virtual void RenderCoveredCells(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
RenderOverlappingCells(DrawingContext)
Declaration
protected virtual void RenderOverlappingCells(DrawingContext dc)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc |
RenderRow(DrawingContext, VisibleLineInfo, Point)
Renders a row of cells. The method calls OnRenderCell(DrawingContext, RenderCellArgs) for each cell. OnRenderCell gets the ICellRenderer for a cell and calls its Render(DrawingContext, RenderCellArgs) method.
Declaration
protected virtual void RenderRow(DrawingContext dc, VisibleLineInfo visibleRow, Point corner)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Media.DrawingContext | dc | The drawing context. |
VisibleLineInfo | visibleRow | The visible row. |
System.Windows.Point | corner | The corner which is the point after the last visible row and column of the body region. |
ScrollInDirection(KeyEventArgs)
Scrolls the grid in arrow key direction. This usually is called from the KeyDown event handler.
Declaration
public void ScrollInDirection(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs instance containing the event data. |
SetArrangeCellArgs(DependencyObject, ArrangeCellArgs)
Declaration
public static void SetArrangeCellArgs(DependencyObject dpo, ArrangeCellArgs value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | |
ArrangeCellArgs | value |
SetCellLayoutDirty()
Declaration
protected void SetCellLayoutDirty()
SetCellRenderer(DependencyObject, ICellRenderer)
Sets the CellRendererProperty attached dependency property value.
Declaration
public static void SetCellRenderer(DependencyObject dpo, ICellRenderer value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be assigned the value of the dependency property. |
ICellRenderer | value | The value. |
SetCellRowColumnIndex(DependencyObject, RowColumnIndex)
Sets the CellRowColumnIndexProperty attached dependency property value.
Declaration
public static void SetCellRowColumnIndex(DependencyObject dpo, RowColumnIndex value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be assigned the value of the dependency property. |
RowColumnIndex | value | The value. |
SetCellsControl(DependencyObject, VirtualizingCellsControl)
Sets the CellsControlProperty attached dependency property value.
Declaration
public static void SetCellsControl(DependencyObject dpo, VirtualizingCellsControl value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be assigned the value of the dependency property. |
VirtualizingCellsControl | value | The value. |
SetCellUIElement(DependencyObject, UIElement)
Sets the CellUIElementProperty attached dependency property value.
Declaration
public static void SetCellUIElement(DependencyObject dpo, UIElement value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be assigned the value of the dependency property. |
System.Windows.UIElement | value | The value. |
SetFrameProperties(VisualContainer, ScrollControlChildFrame)
Declaration
protected override void SetFrameProperties(VisualContainer parent, ScrollControlChildFrame child)
Parameters
Type | Name | Description |
---|---|---|
VisualContainer | parent | |
ScrollControlChildFrame | child |
Overrides
SetRenderCellInfo(DependencyObject, IRenderCellInfo)
Sets the RenderCellInfoProperty attached dependency property value.
Declaration
public static void SetRenderCellInfo(DependencyObject dpo, IRenderCellInfo value)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | dpo | The instance to be assigned the value of the dependency property. |
IRenderCellInfo | value | The value. |
ShouldCellsControlHandleKeyDownScrolling(KeyEventArgs)
Shoulds the cells control handle the key down scrolling in a KeyDown event.
Declaration
protected virtual bool ShouldCellsControlHandleKeyDownScrolling(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e | The System.Windows.Input.KeyEventArgs instance containing the event data. |
Returns
Type |
---|
System.Boolean |
ShouldRenderStyleBackgrounds()
Declaration
protected virtual bool ShouldRenderStyleBackgrounds()
Returns
Type |
---|
System.Boolean |
UnloadArrangedCells()
Clears the visuals for all cells and unloads or recycles the UIElement onjects. Override this method to clear out additional cached information for the cells such as render style information. If UIElements belong to a virtualizing cell renderer with AllowRecycle option enabled they will be moved to recycling bin. Otherwise they will be unloaded.
Declaration
public virtual void UnloadArrangedCells()