DataGrid
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf.Controls
public class DataGrid : System.Windows.Controls.DataGrid
Represents a Fluent table built on the WPF DataGrid; it is the Fluence counterpart of the WinUI 3 TableView.
Remarks: All native DataGrid behavior is kept: column types, sorting, resizing, reordering, frozen leading columns, editing transactions, INotifyDataErrorInfo validation, grouping and filtering through ICollectionView, and row virtualization. The theme supplies Fluent row, cell, header, and group styles.
DataGridTextColumn and DataGridCheckBoxColumn columns that do not set an element or editing style receive the Fluent display and editing styles from the theme, so a column that sets its own style keeps it. When the grid loads and GroupStyle is empty, the grid adds a group style with a Fluent collapsible header; ExpandAllGroups and CollapseAllGroups control those headers.
A frozen SolidColorBrush assigned to HorizontalGridLinesBrush or VerticalGridLinesBrush reads back as a grid-owned copy with the same color, which keeps open edits across theme changes.
Base type: System.Windows.Controls.DataGrid (including inherited WPF and .NET members)
Constructors
DataGrid
public DataGrid()
Initializes a new instance of the DataGrid class.
Properties
CornerRadius
public CornerRadius CornerRadius { get; set; }
Gets or sets the corner radius of the grid's outer border.
EmptyContent
public object? EmptyContent { get; set; }
Gets or sets the content shown over the grid while it has no rows. Set CanUserAddRows to false when the source is editable; otherwise the new-item row counts as a row.
IsItemSelectable
public bool IsItemSelectable { get; set; }
Gets or sets a value indicating whether rows and cells can be selected. Setting it to false clears the selection and suppresses the hover and selection visuals; it is the equivalent of WinUI TableView SelectionMode="None". Cells stay focusable, so keyboard navigation works, and F2 or typing still begins editing. A mouse click does not begin editing, because the native cell starts a click edit only when it is selected. A click briefly selects the row or cell and then clears it, so SelectedCellsChanged, and SelectionChanged when whole rows are selected, report a selection and then its removal. With row selection, a two-way SelectedItem binding sees a transient value.
Methods
CollapseAllGroups
public void CollapseAllGroups()
Collapses every realized group header of this grid that uses the Fluent group header. Groups of a grid nested in a cell or the row details are left as they are.
ExpandAllGroups
public void ExpandAllGroups()
Expands every realized group header of this grid that uses the Fluent group header. Groups of a grid nested in a cell or the row details are left as they are.
Remarks: Grouping turns off row virtualization unless IsVirtualizingWhenGroupingProperty is set, so by default every group is realized.
OnSelectedCellsChanged
protected override void OnSelectedCellsChanged(SelectedCellsChangedEventArgs e)
Clears a new cell selection when IsItemSelectable is false.
Parameter e: The selected-cells change.
OnSelectionChanged
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
Clears a new row selection when IsItemSelectable is false.
Parameter e: The selection change.
Dependency property identifiers
Use these identifiers with WPF property APIs. The matching CLR properties appear above when the control exposes them.
CornerRadiusProperty
public static readonly DependencyProperty CornerRadiusProperty
Identifies the CornerRadius dependency property.
EmptyContentProperty
public static readonly DependencyProperty EmptyContentProperty
Identifies the EmptyContent dependency property.
IsItemSelectableProperty
public static readonly DependencyProperty IsItemSelectableProperty
Identifies the IsItemSelectable dependency property.