Class GridCell
Represents a class that provides the common functionalities of Cells in SfDataGrid.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.DataGrid
Assembly: Syncfusion.Grid.WinUI.dll
Syntax
public class GridCell : ContentControl, IDisposableConstructors
GridCell()
Initializes a new instance of GridCell class.
Declaration
public GridCell()Fields
ErrorMessageProperty
Dependency registration for ErrorMessage.
Declaration
public static readonly DependencyProperty ErrorMessagePropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
SelectionForegroundProperty
Dependency Registration for SelectionForegroundBrush
Declaration
public static readonly DependencyProperty SelectionForegroundPropertyField Value
| Type | 
|---|
| Microsoft.UI.Xaml.DependencyProperty | 
Properties
ColumnBase
Gets the ColumnBase details of the GridCell.
Declaration
public DataColumnBase ColumnBase { get; }Property Value
| Type | 
|---|
| DataColumnBase | 
ErrorMessage
Gets or sets cell error message which is displayed in cell error indicator's ToolTip.
Declaration
public string ErrorMessage { get; set; }Property Value
| Type | 
|---|
| System.String | 
HasError
Gets a value indicating whether GridCell has error or not.
Declaration
public bool HasError { get; }Property Value
| Type | 
|---|
| System.Boolean | 
SelectionForeground
Gets or sets the value for SelectionForeground
Declaration
public Brush SelectionForeground { get; set; }Property Value
| Type | 
|---|
| Microsoft.UI.Xaml.Media.Brush | 
Methods
ApplyGridCellVisualStates(String, Boolean)
Applies the visual state for the Grid cell
Declaration
public void ApplyGridCellVisualStates(string cellRegion, bool canApplyDefaultState = true)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | cellRegion | The corresponding cell region | 
| System.Boolean | canApplyDefaultState | Indicates whether the default state can be applied or not for the particular grid cell. | 
ApplyValidationVisualState(Boolean)
Updates the Visual State of the GridCell based on the cell validation applied on SfDataGrid.
Declaration
protected virtual void ApplyValidationVisualState(bool canApplyDefaultState = true)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Boolean | canApplyDefaultState | 
CanSelectCurrentCell()
Indicates whether the current cell can be selected or not.
Declaration
protected virtual bool CanSelectCurrentCell()Returns
| Type | Description | 
|---|---|
| System.Boolean | true if the current cell can be selected; otherwise false. | 
Dispose()
Disposes all the resources used by the GridCell class.
Declaration
public void Dispose()Dispose(Boolean)
Disposes all the resources used by the GridCell class.
Declaration
protected virtual void Dispose(bool isDisposing)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Boolean | isDisposing | Indicates whether the call is from Dispose method or from a finalizer. | 
OnApplyTemplate()
Invoked to apply template for GridCell.
Declaration
protected override void OnApplyTemplate()OnColumnChanged()
Invoked when columns are reused in horizontal scrolling.
Declaration
protected virtual void OnColumnChanged()OnCreateAutomationPeer()
Returns a class-specific AutomationPeer Implementations for the Microsoft UI Automation infrasturcutre.
Declaration
protected override AutomationPeer OnCreateAutomationPeer()Returns
| Type | Description | 
|---|---|
| Microsoft.UI.Xaml.Automation.Peers.AutomationPeer | The class-specific AutomationPeer subclass. | 
OnDataColumnPropertyChanged(String)
Invoked when ColumnBase properties are changed.
Declaration
protected virtual void OnDataColumnPropertyChanged(string propertyName)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | propertyName | The name of the property which is changed in ColumnBase. | 
OnDoubleTapped(DoubleTappedRoutedEventArgs)
Called before the Double tapped event occurs.
Declaration
protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.DoubleTappedRoutedEventArgs | e | 
OnHolding(HoldingRoutedEventArgs)
When long press on SfDataGrid Cell, Context menu appears for the selected cell. We are using this event for context menu support in Record cell, Caption Summary cell, Table summary cell and Group summary cells.
Declaration
protected override void OnHolding(HoldingRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.HoldingRoutedEventArgs | e | Holding event arguments | 
OnPointerEntered(PointerRoutedEventArgs)
Method override to set tooltip for GridCell.
Declaration
protected override void OnPointerEntered(PointerRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e | 
OnPointerMoved(PointerRoutedEventArgs)
Called before the Pointer moved event occurs.
Declaration
protected override void OnPointerMoved(PointerRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e | 
OnPointerPressed(PointerRoutedEventArgs)
Called before the Pointer pressed event occurs.
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e | 
OnPointerReleased(PointerRoutedEventArgs)
Called before the Pointer released event occurs.
Declaration
protected override void OnPointerReleased(PointerRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.PointerRoutedEventArgs | e | 
OnRightTapped(RightTappedRoutedEventArgs)
When Right click the SfDataGrid Cell, Context menu appears for the selected cell. We are using this event for context menu support in Record cell, Caption Summary cell, Table summary cell and Group summary cells.
Declaration
protected override void OnRightTapped(RightTappedRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.RightTappedRoutedEventArgs | e | Right tapped event arguments | 
OnTapped(TappedRoutedEventArgs)
Called before the Tapped event occurs.
Declaration
protected override void OnTapped(TappedRoutedEventArgs e)Parameters
| Type | Name | Description | 
|---|---|---|
| Microsoft.UI.Xaml.Input.TappedRoutedEventArgs | e | 
ShowContextFlyout(Point)
Opens the context flyout at the specified position.
Declaration
protected virtual bool ShowContextFlyout(Point position)Parameters
| Type | Name | Description | 
|---|---|---|
| Windows.Foundation.Point | position | The position to display context flyout. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | true If the context flyout opened;Otherwisefalse |