menu

WinUI

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfGridBase - WinUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SfGridBase

    Provides the base implementation of SfDataGrid.

    Inheritance
    System.Object
    SfGridBase
    SfDataGrid
    SfTreeGrid
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.Grids
    Assembly: Syncfusion.Grid.WinUI.dll
    Syntax
    public class SfGridBase : Control, IDisposable

    Constructors

    SfGridBase()

    Declaration
    public SfGridBase()

    Fields

    AllowDraggingColumnsProperty

    Identifies the AllowDraggingColumns dependency property.

    Declaration
    public static readonly DependencyProperty AllowDraggingColumnsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowDraggingColumns dependency property.

    AllowEditingProperty

    Identifies the AllowEditing dependency property.

    Declaration
    public static readonly DependencyProperty AllowEditingProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowEditing dependency property.

    AllowResizingColumnsProperty

    Identifies the AllowResizingColumns dependency property.

    Declaration
    public static readonly DependencyProperty AllowResizingColumnsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowResizingColumns dependency property.

    AllowResizingHiddenColumnsProperty

    Identifies the AllowResizingHiddenColumns dependency property.

    Declaration
    public static readonly DependencyProperty AllowResizingHiddenColumnsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowResizingHiddenColumns dependency property.

    AllowRowDragDropProperty

    Identifies the AllowRowDragDrop dependency property.

    Declaration
    public static readonly DependencyProperty AllowRowDragDropProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowRowDragDrop dependency property.

    AllowSelectionOnPointerPressedProperty

    Identifies the AllowSelectionOnPointerPressed dependency property.

    Declaration
    public static readonly DependencyProperty AllowSelectionOnPointerPressedProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowSelectionOnPointerPressed dependency property.

    AllowSortingProperty

    Identifies the AllowSorting dependency property.

    Declaration
    public static readonly DependencyProperty AllowSortingProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowSorting dependency property.

    AllowTriStateSortingProperty

    Identifies the AllowTriStateSorting dependency property.

    Declaration
    public static readonly DependencyProperty AllowTriStateSortingProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AllowTriStateSorting dependency property.

    AutoGenerateColumnsForCustomTypeProperty

    Identifies the AutoGenerateColumnsForCustomType dependency property.

    Declaration
    public static readonly DependencyProperty AutoGenerateColumnsForCustomTypeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AutoGenerateColumnsForCustomType dependency property.

    AutoGenerateColumnsModeForCustomTypeProperty

    Identifies the AutoGenerateColumnsModeForCustomType dependency property.

    Declaration
    public static readonly DependencyProperty AutoGenerateColumnsModeForCustomTypeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AutoGenerateColumnsModeForCustomType dependency property.

    AutoGenerateColumnsModeProperty

    Identifies the AutoGenerateColumnsMode dependency property.

    Declaration
    public static readonly DependencyProperty AutoGenerateColumnsModeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AutoGenerateColumnsMode dependency property.

    AutoGenerateColumnsProperty

    Identifies the AutoGenerateColumns dependency property.

    Declaration
    public static readonly DependencyProperty AutoGenerateColumnsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the AutoGenerateColumns dependency property.

    CellTemplateSelectorProperty

    Identifies the CellTemplateSelector dependency property.

    Declaration
    public static readonly DependencyProperty CellTemplateSelectorProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the CellTemplateSelector dependency property.

    CopyOptionProperty

    Identifies the CopyOption dependency property.

    Declaration
    public static readonly DependencyProperty CopyOptionProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the CopyOption dependency property.

    CurrentCellBorderBrushProperty

    Identifies the CurrentCellBorderBrush dependency property.

    Declaration
    public static readonly DependencyProperty CurrentCellBorderBrushProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the CurrentCellBorderBrush dependency property.

    CurrentCellBorderThicknessProperty

    Identifies the CurrentCellBorderThickness dependency property.

    Declaration
    public static readonly DependencyProperty CurrentCellBorderThicknessProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the CurrentCellBorderThickness dependency property.

    DataValidationModeProperty

    Identifies the DataValidationMode dependency property.

    Declaration
    public static readonly DependencyProperty DataValidationModeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the DataValidationMode dependency property.

    EditorSelectionBehaviorProperty

    Identifies the EditorSelectionBehavior dependency property.

    Declaration
    public static readonly DependencyProperty EditorSelectionBehaviorProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the EditorSelectionBehavior dependency property.

    EditTriggerProperty

    Identifies the EditTrigger dependency property.

    Declaration
    public static readonly DependencyProperty EditTriggerProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the EditTrigger dependency property.

    FrozenColumnsCountProperty

    Identifies the FrozenColumnsCount dependency property.

    Declaration
    public static readonly DependencyProperty FrozenColumnsCountProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the FrozenColumnsCount dependency property.

    FrozenFooterColumnsCountProperty

    Identifies the FrozenFooterColumnsCount dependency property.

    Declaration
    public static readonly DependencyProperty FrozenFooterColumnsCountProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the FrozenFooterColumnsCount dependency property.

    GridLinesVisibilityProperty

    Identifies the GridLinesVisibility dependency property.

    Declaration
    public static readonly DependencyProperty GridLinesVisibilityProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the GridLinesVisibility dependency property.

    HeaderContextFlyoutProperty

    Identifies the HeaderContextFlyout dependency property.

    Declaration
    public static readonly DependencyProperty HeaderContextFlyoutProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the HeaderContextFlyout dependency property.

    HeaderLinesVisibilityProperty

    Identifies the HeaderLinesVisibility dependency property.

    Declaration
    public static readonly DependencyProperty HeaderLinesVisibilityProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the HeaderLinesVisibility dependency property.

    HeaderRowHeightProperty

    Identifies the HeaderRowHeight dependency property.

    Declaration
    public static readonly DependencyProperty HeaderRowHeightProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the HeaderRowHeight dependency property.

    IsReadOnlyProperty

    Identifies the IsReadOnly dependency property.

    Declaration
    public static readonly DependencyProperty IsReadOnlyProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the IsReadOnly dependency property.

    NavigationModeProperty

    Identifies the NavigationMode dependency property.

    Declaration
    public static readonly DependencyProperty NavigationModeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the NavigationMode dependency property.

    PasteOptionProperty

    Identifies the PasteOption dependency property.

    Declaration
    public static readonly DependencyProperty PasteOptionProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the PasteOption dependency property.

    RecordContextFlyoutProperty

    Identifies the RecordContextFlyout dependency property.

    Declaration
    public static readonly DependencyProperty RecordContextFlyoutProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the RecordContextFlyout dependency property.

    RowHeaderWidthProperty

    Identifies the RowHeaderWidth dependency property.

    Declaration
    public static readonly DependencyProperty RowHeaderWidthProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the RowHeaderWidth dependency property.

    RowHeightProperty

    Identifies the RowHeight dependency property.

    Declaration
    public static readonly DependencyProperty RowHeightProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the RowHeight dependency property.

    SelectedIndexProperty

    Identifies the SelectedIndex dependency property.

    Declaration
    public static readonly DependencyProperty SelectedIndexProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SelectedIndex dependency property.

    SelectedItemProperty

    Identifies the SelectedItem dependency property.

    Declaration
    public static readonly DependencyProperty SelectedItemProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SelectedItem dependency property.

    SelectedItemsProperty

    Identifies the SelectedItems dependency property.

    Declaration
    public static readonly DependencyProperty SelectedItemsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SelectedItems dependency property.

    SelectionModeProperty

    Identifies the SelectionMode dependency property.

    Declaration
    public static readonly DependencyProperty SelectionModeProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SelectionMode dependency property.

    ShowRowHeaderProperty

    Identifies the ShowRowHeader dependency property.

    Declaration
    public static readonly DependencyProperty ShowRowHeaderProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the Syncfusion.UI.Xaml.Grids.SfGridBase.showRowHeader dependency property.

    ShowSortNumbersProperty

    Identifies the ShowSortNumbers dependency property.

    Declaration
    public static readonly DependencyProperty ShowSortNumbersProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the ShowSortNumbers dependency property.

    ShowToolTipProperty

    Identifies the ShowToolTip dependency property.

    Declaration
    public static readonly DependencyProperty ShowToolTipProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the ShowToolTip dependency property.

    SortClickActionProperty

    Identifies the SortClickAction dependency property.

    Declaration
    public static readonly DependencyProperty SortClickActionProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SortClickAction dependency property.

    SortColumnDescriptionsProperty

    Identifies the SortColumnDescriptions dependency property.

    Declaration
    public static readonly DependencyProperty SortColumnDescriptionsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the SortColumnDescriptions dependency property.

    StackedHeaderRowsProperty

    Identifies the StackedHeaderRows dependency property.

    Declaration
    public static readonly DependencyProperty StackedHeaderRowsProperty
    Field Value
    Type
    Microsoft.UI.Xaml.DependencyProperty
    Remarks

    The identifier for the StackedHeaderRows dependency property.

    Properties

    AllowDraggingColumns

    Gets or sets a value that indicates whether the column can be repositioned by using mouse or touch.

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

    true if the column can be repositioned by using mouse or touch; otherwise, false. The default value is false.

    Remarks

    For SfDataGrid, the dragging operation can be customized through ColumnDragging event handler. For SfTreeGrid, the dragging operation can be customized through ColumnDragging event handler.

    AllowEditing

    Gets or sets a value that indicates whether the user can edit the cells.

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

    true if user can edit the cells; otherwise, false. The default value is false.

    Remarks

    CurrentCellBeginEdit and CurrentCellEndEdit events occurs when editing starts for current cell and editing ends for current cell in SfDataGrid. CurrentCellBeginEdit and CurrentCellEndEdit events occurs when editing starts for current cell and editing ends for current cell in SfTreeGrid.

    See Also
    IsReadOnly
    EditTrigger

    AllowResizingColumns

    Gets or sets a value that indicates whether the user can adjust the column width by using the mouse.

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

    true if the columns are allowed for resizing; otherwise, false. The default value is false.

    Remarks

    For SfDataGrid you can cancel or customize the resizing operations through ResizingColumns event handler. For SfTreeGrid you can cancel or customize the resizing operations through ResizingColumns event handler.

    See Also
    GridRowSizingOptions

    AllowResizingHiddenColumns

    Gets or sets a value that indicates whether the hidden column can be resized using the mouse.

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

    true if the resizing can be enabled for the hidden columns; otherwise, false. The default value is false.

    AllowRowDragDrop

    Gets or sets a value that indicates whether the user can drag and drop rows.

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

    true if the rows can be drag and drop; Otherwise, false. The default value is false.

    AllowSelectionOnPointerPressed

    Gets or sets a value that indicates whether the selection should be present in the PointerPressed state.

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

    true if the row or cell can be selected in PointerPressed; otherwise, false. The default value is false.

    AllowSorting

    Gets or sets a value that indicates whether the user can sort the data by clicking on its header cell of the column.

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

    true if the sorting is enabled; otherwise, false. The default value is true.

    Remarks

    For SfDataGrid, the SortColumnsChanging and SortColumnsChanged events occurs , when the sorting operation is performed. For SfTreeGrid, the SortColumnsChanging and SortColumnsChanged events occurs , when the sorting operation is performed. In SfDataGrid you can cancel or customize the sorting operation through SortColumnsChanging event handler. In SfTreeGrid you can cancel or customize the sorting operation through SortColumnsChanging event handler.

    See Also
    ShowSortNumbers
    SortClickAction
    AllowTriStateSorting
    SortColumnDescriptions

    AllowTriStateSorting

    Gets or sets a value that indicates whether the user can sort the data to its initial order other than ascending or descending order.

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

    true if the data can be arranged to initial order; otherwise, false. The default value is false.

    AutoGenerateColumns

    Gets or sets a value that indicates whether the columns should be created automatically.

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

    true if the columns can be automatically generated; otherwise, false. The default value is true.

    Remarks

    For SfDataGrid, each column gets notified in the AutoGeneratingColumn event during its creation. For SfTreeGrid, each column gets notified in the AutoGeneratingColumn event during its creation. You can cancel or customize the column being created by using this event.

    See Also
    AutoGenerateColumnsForCustomType
    AutoGenerateColumnsMode

    AutoGenerateColumnsForCustomType

    Gets or sets a value that indicates whether to generate columns automatically for the custom types in data object.

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

    true if the custom type properties are automatically generated; otherwise, false. The default value is false.

    Remarks

    Setting AutoGenerateColumnsForCustomType to true, generate columns for inner properties.For example, OrderInfo class has Customer property of type Customer, then column generated like Customer.CustomerID.

    AutoGenerateColumnsMode

    Gets or sets a value that indicates how the columns are generated during automatic column generation.

    Declaration
    public AutoGenerateColumnsMode AutoGenerateColumnsMode { get; set; }
    Property Value
    Type Description
    AutoGenerateColumnsMode

    One of the AutoGenerateColumnsMode enumeration that specifies how the columns are auto generated. The default value is None.

    AutoGenerateColumnsModeForCustomType

    Gets or sets the AutoGenerateColumnsModeForCustomType that indicates whether to create the columns for custom parent type or child inner properties or custom type and its child properties.

    Declaration
    public AutoGenerateColumnsModeForCustomType AutoGenerateColumnsModeForCustomType { get; set; }
    Property Value
    Type Description
    AutoGenerateColumnsModeForCustomType

    One of the AutoGenerateColumnsModeForCustomType enumeration that specified how the custom type columns are auto generated. The default is Child.

    Remarks

    By default, the columns are created for custom type child properties.

    CellTemplateSelector

    Gets or sets the Microsoft.UI.Xaml.DataTemplate by choosing a template conditionally based on data.

    Declaration
    public DataTemplateSelector CellTemplateSelector { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Controls.DataTemplateSelector

    A custom Microsoft.UI.Xaml.Controls.DataTemplateSelector object that chooses the Microsoft.UI.Xaml.DataTemplate based on data. The default value is null.

    See Also
    CellTemplate

    CopyOption

    Gets or sets a value that indicates how the content is copied from control to the clipboard.

    Declaration
    public GridCopyOptions CopyOption { get; set; }
    Property Value
    Type Description
    GridCopyOptions

    One of the GridCopyOptions enumeration that specifies how the content is copied from control to the clipboard. The default value is CopyData.

    Remarks

    You can cancel or customize the copy operation through GridCopyContent and CopyGridCellContent event handlers in SfDataGrid. You can cancel or customize the copy operation through CopyContent and CopyCellContent event handlers in SfTreeGrid.

    See Also
    DataGridClipboardController
    TreeGridClipboardController

    CurrentCellBorderBrush

    Gets or sets a brush that is used to draw the border color of the current cell.

    Declaration
    public Brush CurrentCellBorderBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush

    The border color of the current cell. The default value is black.

    See Also
    CurrentCellBorderThickness

    CurrentCellBorderThickness

    Gets or sets the width for the boundaries of the current cell border.

    Declaration
    public Thickness CurrentCellBorderThickness { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Thickness

    The width of the current cell border. The default value is 2.

    See Also
    CurrentCellBorderBrush

    DataValidationMode

    Gets or sets a value to enable the built-in validation (INotifyDataErrorInfo/DataAnnonations) to validate the user input and displays the error.

    Declaration
    public GridValidationMode DataValidationMode { get; set; }
    Property Value
    Type Description
    GridValidationMode

    One of the GridValidationMode enumeration that specifies how the row or cell is validated. The default mode is None.

    Remarks

    The DataValidationMode process the built-in validations when data object implements and System.ComponentModel.DataAnnotations. The validation can also be done using CurrentCellValidating and RowValidating events.

    EditorSelectionBehavior

    Gets or sets value that indicates the position of cursor and selection in edit element when entering edit mode.

    Declaration
    public EditorSelectionBehavior EditorSelectionBehavior { get; set; }
    Property Value
    Type Description
    EditorSelectionBehavior

    One of the EditorSelectionBehavior enumeration that denotes the position of cursor and selection in edit mode. The default value is SelectAll.

    See Also
    LostFocusBehavior

    EditTrigger

    Gets or sets a value that indicates the mouse action that triggers editing.

    Declaration
    public EditTrigger EditTrigger { get; set; }
    Property Value
    Type Description
    EditTrigger

    One of the EditTrigger enumeration that specifies the mouse action that triggers the editing. The default value is OnDoubleTap.

    See Also
    EditorSelectionBehavior

    FrozenColumnsCount

    Gets or sets the number of non-scrolling columns at left of the grid.

    Declaration
    public int FrozenColumnsCount { get; set; }
    Property Value
    Type Description
    System.Int32

    The number of non-scrolling columns at left. The default value is zero.

    Remarks

    Frozen columns are always displayed and it can't be scrolled out of visibility.

    See Also
    FrozenRowsCount

    FrozenFooterColumnsCount

    Gets or sets the number of non-scrolling columns at right of the grid.

    Declaration
    public int FrozenFooterColumnsCount { get; set; }
    Property Value
    Type Description
    System.Int32

    The number of non-scrolling columns at right. The default value is zero.

    Remarks

    Footer columns are always displayed and it can't be scrolled out of visibility.

    See Also
    FrozenRowsCount
    FrozenFooterRowsCount

    GridLinesVisibility

    Gets or sets a value that specifies the horizontal and vertical lines visibility of the cells in grid (except header cells).

    Declaration
    public GridLinesVisibility GridLinesVisibility { get; set; }
    Property Value
    Type Description
    GridLinesVisibility

    The default value is None.

    Remarks

    By default, vertical and horizontal lines are visible in grid. You can hide both grid lines, or either one of them using GridLinesVisibility property. This is applicable for caption row, filter row and summary rows.

    See Also
    HeaderLinesVisibility

    HeaderContextFlyout

    Gets or sets the shortcut menu that appears on each header cells.

    Declaration
    public MenuFlyout HeaderContextFlyout { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Controls.MenuFlyout

    The shortcut menu for each header cells. The default value is null.

    Remarks

    Command bound with MenuItem receives GridColumnContextFlyoutInfo for SfDataGrid and MenuFlyoutItem receives TreeGridColumnContextFlyoutInfo for SfTreeGrid as command parameter which contains the corresponding record.

    Examples
    // control may be SfDataGrid or SfTreeGrid.
    <dataGrid:SfDataGrid.HeaderContextFlyout>
        <MenuFlyout>
            <MenuFlyoutItem Text="Sort Ascending" />
            <MenuFlyoutItem Text="Sort Descending" />
            <MenuFlyoutItem Text="Group by this Column" />
            <MenuFlyoutItem Text="Expand/Collapse Group Drop Area" />
            <MenuFlyoutItem Text="Clear Sorting" />
            <MenuFlyoutItem Text="Clear Filtering" />
            <MenuFlyoutItem Text="Best Fit" />
        </MenuFlyout>
    </dataGrid:SfDataGrid.HeaderContextFlyout>

    HeaderLinesVisibility

    Gets or sets a value that specifies the horizontal and vertical lines visibility of the stacked header cells and header cells in grid.

    Declaration
    public GridLinesVisibility HeaderLinesVisibility { get; set; }
    Property Value
    Type Description
    GridLinesVisibility

    The default value is Both.

    See Also
    GridLinesVisibility

    HeaderRowHeight

    Gets or sets the height of header row.

    Declaration
    public double HeaderRowHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The height of the header row.

    Remarks

    Header row can be hide by setting HeaderRowHeight as zero.

    IsReadOnly

    Gets or sets the value that determines if the user can change the text in the GridCell.

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

    trueif the GridCell is in read-only state; otherwise, false. The default value is false.

    Remarks

    If the GridCell is read-only state, no user input or edits are allowed, but programmatic changes can be made. The user can still select text, and the key events are marked as handled. The difference between the AllowEditing and IsReadOnly behavior is user input. AllowEditing allows the user inputs but IsReadOnly won't allow.

    NavigationMode

    Gets or sets the NavigationMode that indicates whether the navigation can be accomplished based on either cell or row.

    Declaration
    public NavigationMode NavigationMode { get; set; }
    Property Value
    Type Description
    NavigationMode

    One of the NavigationMode enumeration that specifies the navigation based on either row or cell. The default registered mode is Cell.

    See Also
    SelectionMode

    PasteOption

    Gets or sets a value that indicates how the clipboard value is pasted.

    Declaration
    public GridPasteOptions PasteOption { get; set; }
    Property Value
    Type Description
    GridPasteOptions

    One of the GridPasteOptions enumeration that specifies how the clipboard value is pasted. The default value is PasteData.

    Remarks

    You can customize or cancel the paste operations through GridPasteContent and PasteGridCellContent event handlers in SfDataGrid. You can cancel or customize the paste operations through PasteContent and PasteCellContent event handlers in SfTreeGrid.

    See Also
    DataGridClipboardController
    TreeGridClipboardController

    RecordContextFlyout

    Gets or sets the shortcut menu that appears on each record cells.

    Declaration
    public MenuFlyout RecordContextFlyout { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Controls.MenuFlyout

    The shortcut menu for each record. The default value is null.

    Remarks

    Command bound with MenuItem receives GridRecordContextFlyoutInfo for SfDataGrid and MenuFlyoutItem receives TreeGridNodeContextFlyoutInfo for SfTreeGrid as command parameter which contains the corresponding record.

    Examples
    // control may be SfDataGrid or SfTreeGrid.
    <dataGrid:SfDataGrid.RecordContextFlyout>
        <MenuFlyout>
            <MenuFlyoutItem Text="Cut" />
            <MenuFlyoutItem Text="Copy" />
            <MenuFlyoutItem Text="Paste" />
            <MenuFlyoutItem Text="Delete" />
        </MenuFlyout>
    </dataGrid:SfDataGrid.RecordContextFlyout>

    RowHeaderWidth

    Gets or sets the width of the RowHeader.

    Declaration
    public double RowHeaderWidth { get; set; }
    Property Value
    Type Description
    System.Double

    The width of the RowHeader.

    Remarks

    RowHeader can be enabled by setting ShowRowHeader as true.

    RowHeight

    Gets or sets the height for record rows.

    Declaration
    public double RowHeight { get; set; }
    Property Value
    Type Description
    System.Double

    The height of record row.

    Remarks

    Particular record row height can be changed by specifying row index in VisualContainer.RowHeights for SfDataGrid and TreeGridPanel.RowHeights for SfTreeGrid. Once row heights are changed, need to call the InvalidateMeasureInfo method of VisualContainer for SfDataGrid and TreeGridPanel for SfTreeGrid to refresh the view.

    Examples
            
    using Syncfusion.UI.Xaml.Grid.Helpers;
    
    var visualContainer = this.dataGrid.GetVisualContainer();
    //Set RowHeight to 2'nd row
    visualContainer.RowHeights[2] = 50;
    visualContainer.InvalidateMeasure();
            
    using Syncfusion.UI.Xaml.TreeGrid.Helpers;
    
    var treeGridPanel = this.treeGrid.GetTreePanel();
    //Set RowHeight to 2'nd row
    treeGridPanel.RowHeights[2] = 50;
    treeGridPanel.InvalidateMeasure();
    See Also
    HeaderRowHeight
    QueryRowHeight

    SelectedIndex

    Gets or sets the index of corresponding selected cell or row.

    Declaration
    public int SelectedIndex { get; set; }
    Property Value
    Type Description
    System.Int32

    The index of the selected item. The default value is -1.

    SelectedItem

    Gets or sets the data item bound to the row or cell that contains the current cell.

    Declaration
    public object SelectedItem { get; set; }
    Property Value
    Type Description
    System.Object

    The object that is the currently selected item or null if there is no currently selected item.

    SelectedItems

    Gets the collection of object that contains data item of corresponding to the selected cells or rows.

    Declaration
    public ObservableCollection<object> SelectedItems { get; set; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<System.Object>

    The collection of object that contains data item corresponding to the selected cells or rows.

    SelectionMode

    Gets or sets the value that indicates how the rows or cells are selected.

    Declaration
    public GridSelectionMode SelectionMode { get; set; }
    Property Value
    Type Description
    GridSelectionMode

    One of the GridSelectionMode enumeration that specifies the selection behavior. The default value is Single.

    See Also
    SelectedItem
    SelectedIndex
    GridSelectionUnit
    NavigationMode

    ShowRowHeader

    Gets or sets a value that indicates the visibility of RowHeader column which is used to denote the status of row.

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

    true if the RowHeader is visible; otherwise, false. The default value is false.

    Remarks

    RowHeader is a special column used to indicate the status of row (current row, editing status, errors in row, etc.) which is placed as first cell of each row.

    See Also
    RowHeaderWidth

    ShowSortNumbers

    Gets or sets a value that indicates whether the sequence number should be displayed on the header cell of sorted column during multi-column sorting.

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

    true if the sequence number is displayed on the header cell of sorted column; otherwise, false. The default value is false.

    Remarks

    The multi-column sorting can be applied by pressing CTRL key and the corresponding sequence number is displayed on its header cell of the column simultaneously.

    ShowToolTip

    Gets or sets value that indicates whether the tooltip should be displayed when mouse hovered on the cells in the control.

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

    true if the tool tip is enabled in the column; otherwise, false. The default value is false.

    Examples
    <Page.Resources>
       <DataTemplate x:Key="orderIDColumnToolTip">
           <Grid>
              <Rectangle Fill = "Transparent" />
              < TextBlock Text="{Binding OrderID}" FontWeight="Bold" Foreground="Red" />
           </Grid>
       </DataTemplate>
    </Page.Resources>
    <syncfusion:SfDataGrid.Columns>
      <syncfusion:GridTextColumn HeaderText = "Order ID" ShowToolTip="True" ToolTipTemplate="{StaticResource orderIDColumnToolTip}" MappingName="OrderID" >
    <syncfusion:SfDataGrid.Columns>
    See Also
    ShowHeaderToolTip
    HeaderToolTipTemplate
    ShowToolTip
    ToolTipTemplate
    ToolTipTemplateSelector

    SortClickAction

    Gets or sets a value that indicates whether the user can sort the data either at single or double click.

    Declaration
    public SortClickAction SortClickAction { get; set; }
    Property Value
    Type Description
    SortClickAction

    One of the SortClickAction enumeration that specifies the sort click action. The default value is SingleClick.

    SortColumnDescriptions

    Gets or sets the collection of SortColumnDescription objects to sort the data programmatically.

    Declaration
    public SortColumnDescriptions SortColumnDescriptions { get; set; }
    Property Value
    Type Description
    SortColumnDescriptions

    The collection of SortColumnDescription object to sort the data programmatically. The default value is null.

    Examples
    this.dataGrid.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnName = "OrderID", SortDirection = ListSortDirection.Ascending });
    this.dataGrid.SortColumnDescriptions.Add(new SortColumnDescription() { ColumnName = "CustomerName", SortDirection = ListSortDirection.Descending });

    StackedHeaderRows

    Gets or sets the collection of StackedHeaderRow to add additional headers to group and display the column headers.

    Declaration
    public StackedHeaderRows StackedHeaderRows { get; set; }
    Property Value
    Type Description
    StackedHeaderRows

    The collection of StackedHeaderRow. The default value is null.

    Examples
    // control may be SfDataGrid or SfTreeGrid.
    var stackedHeaderRow1 = new StackedHeaderRow();
    stackedHeaderRow1.StackedColumns.Add(new StackedColumn() { ChildColumns = "OrderID,OrderDate,Quantity,UnitPrice,ShipCity,ShipAddress" , HeaderText = "Sales Details", MappingName = "SalesDetails" });
    this.grid.StackedHeaderRows.Add(stackedHeaderRow1);

    Methods

    CreateColumn(PropertyInfo, DisplayAttribute, out Boolean)

    Used to create the column for the specified property.

    Declaration
    protected GridColumnBase CreateColumn(PropertyInfo propertyinfo, DisplayAttribute displayAttribute, out bool cancelArgs)
    Parameters
    Type Name Description
    System.Reflection.PropertyInfo propertyinfo

    Provides an abstraction of a property on a class.

    System.ComponentModel.DataAnnotations.DisplayAttribute displayAttribute

    Provides a general purpose attribute that allows you to specify display attributes for specified properties of the class.

    System.Boolean cancelArgs

    Specifies whether to create columns based on property type or not.

    Returns
    Type Description
    GridColumnBase

    Returns the created column for the specified property.

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Indicates whether the call is from dispose method or from a finalizer.

    Implements

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