DataGrid
- Assembly:
Fluence.Wpf - Namespace:
Fluence.Wpf.Controls
public class DataGrid : System.Windows.Controls.DataGrid
Represents a table of bound rows and columns built on the WPF DataGrid. It covers the WinUI 3 TableView scenarios with WPF names.
Remarks: Column types, sorting, resizing, reordering, frozen leading columns, editing, INotifyDataErrorInfo validation, grouping and filtering through ICollectionView, and row virtualization work as they do in WPF.
When the grid loads and GroupStyle is empty, the grid shows each group under a collapsible header. ExpandAllGroups and CollapseAllGroups open or close those headers.
A frozen SolidColorBrush assigned to HorizontalGridLinesBrush or VerticalGridLinesBrush reads back as a grid-owned copy with the same color.
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 selection, keeps the single-selection properties empty, and suppresses selection events for rejected row or cell selections. Existing selection still reports its removal when this property changes to false. The native SelectedItems and SelectedCells collections can briefly contain a rejected entry before the deferred clear. This is the WPF adaptation 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.
Methods
CollapseAllGroups
public void CollapseAllGroups()
Collapses every realized group header of this grid that uses the built-in 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 built-in 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 rejected cell selection without publishing its native selection event.
Parameter e: The selected-cells change.
OnSelectionChanged
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
Clears a rejected row selection without publishing its native selection event.
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.