-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #814 from telerik/development
Development
- Loading branch information
Showing
35 changed files
with
430 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Group Header Template | ||
page_title: .NET MAUI DataGrid Documentation - GroupHeaderTemplate | ||
description: "Review the Telerik .NET MAUI DataGrid Property Group Descriptor documentation article to learn more about the property grouping function you can use." | ||
position: 5 | ||
slug: datagrid-group-header-template | ||
--- | ||
|
||
# Group Header Template for .NET MAUI DataGrid | ||
|
||
The .NET MAUI DataGrid features fully customizable group headers that allow you to tweak the appearance and behavior of the headers used to group data within the grid. You can achieve this customization by using the `GroupHeaderTemplate` property of the DataGrid, which allows you to set a custom `DataTemplate` to the group headers. | ||
|
||
The BindingContext of the `GroupHeaderTemplate` is a `GroupHeaderContext` object and it includes the following properties: | ||
|
||
* `Descriptor`: Specifies the descriptor used for the grouping. | ||
* `Group`: Gets details on the group such as: | ||
* `Items`: Gets the child items of the group. | ||
* `Key`: Gets the key specific for the group. | ||
* `IsExpanded`: Defines a value indicating whether the group is currently expanded (has its child items visible). | ||
* `Level`: Gets the zero-based level (or the depth) of the group. | ||
|
||
The following example demonstrates how to apply a sample `GroupHeaderTemplate` to the DataGrid: | ||
|
||
**1.** Add the DataGrid definition to the page with a sample `GroupHeaderTemplate`: | ||
|
||
<snippet id='datagrid-groupheader-template-xaml' /> | ||
|
||
**2.** Add the `ViewModel` class: | ||
|
||
<snippet id='datagrid-grouping-viewmodel' /> | ||
|
||
**3.** Add the data item used for binding the DataGrid: | ||
|
||
<snippet id='datagrid-grouping-object' /> | ||
|
||
**4.** Set the binding context of the DataGrid to the `ViewModel` class: | ||
|
||
<snippet id='datagrid-grouping-propertygroupdescriptor-setvm' /> | ||
|
||
Check the result at the image below: | ||
|
||
![Telerik .NET MAUI DataGrid Group Header Template](../images/datagrid-grouping-groupheadertemplate.png) | ||
|
||
## See Also | ||
|
||
- [Grouping UI]({%slug datagrid-grouping-ui%}) | ||
- [Property Group Descriptor]({%slug datagrid-property-group-descriptor%}) | ||
- [Delegate Group Descriptor]({%slug datagrid-delegate-group-descriptor%}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--- | ||
title: Binding to Collection | ||
page_title: .NET MAUI DataGrid Documentation - Data Binding | ||
description: Learn how to bind the Telerik .NET MAUI DataGrid to a collection of items and configure the data bindings for its columns. | ||
position: 1 | ||
slug: datagrid-data-binding | ||
tags: binding, collection, data, dotnet maui, maui, datagrid, enumerable | ||
--- | ||
|
||
# .NET MAUI DataGrid Data Binding: Binding to a Collection | ||
|
||
This article lists the source types supported by Telerik's .NET MAUI DataGrid. It guides you through the process of binding the DataGrid control to a collection of items and configuring the data binding for its columns. | ||
|
||
## Supported Collection Sources | ||
|
||
To populate the DataGrid with data, use the `ItemsSource` property of the control. For compatibility reasons, the `ItemsSource` property of the .NET MAUI DataGrid is declared as a `System.Object` type. However, using collections that implement the `IEnumerable` interface is recommended as it gives you more flexibility. | ||
|
||
## Binding to an ObservableCollection | ||
|
||
When you bind the `RadDataGrid` to a collection that implements the `INotifyCollectionChanged` interface, the DataGrid reflects and displays all changes to that collection, for example, any adding or removing of data items. The .NET MAUI framework implements the `INotifyCollectionChanged` interface in the `ObservableCollection<T>` class. | ||
|
||
Implementations of the `System.ComponentModel.ICollection` interface are also fully supported. When using such collection sources, the `RadDataGrid` automatically picks up any group, sort, or filter descriptions defined in the collection and uses them to display the data. This makes the `System.ComponentModel.ICollection` interface implementations the recommended collection source for the DataGrid. | ||
|
||
The next example demonstrates how to bind the DataGrid to an `ObservableCollection`. For this example, the DataGrid control is bound to a collection of `Club` objects. Note that the `Club` class inherits from `NotifyPropertyChangedBase`, which is the Telerik implementation of the `INotifyPropertyChanged` interface. | ||
|
||
**1.** Define the `Club` class: | ||
|
||
<snippet id='datagrid-club-model' /> | ||
|
||
**2.** Create an `ObservableCollection` in the `ViewModel` class: | ||
|
||
<snippet id='datagrid-column-view-model' /> | ||
|
||
**3.** Bind the collection to the `RadDataGrid` control: | ||
|
||
```xaml | ||
<telerik:RadDataGrid x:Name="grid" | ||
ItemsSource="{Binding Clubs}" /> | ||
``` | ||
|
||
**4.** Add the `telerik` namespace: | ||
|
||
```XAML | ||
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui" | ||
``` | ||
|
||
## Binding the Columns | ||
|
||
By default, DataGrid will generate typed columns automatically based on the public properties of the underlying data objects. When, for example, you set the `ItemsSource` of the `RadDataGrid` to a collection of clubs (see the sample above), the control will create a separate column for each public property of the `Club` object. | ||
|
||
To disable the automatic generation of DataGrid columns and manually define them, set the control's `AutoGenerateColumns` property to `False` and manually populate the `Columns` collection. | ||
|
||
**1.** Define the columns: | ||
|
||
<snippet id='datagrid-columns-example' /> | ||
|
||
**2.** Add the `telerik` namespace: | ||
|
||
```XAML | ||
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui" | ||
``` | ||
|
||
**3.** Define the `Club` class: | ||
|
||
<snippet id='datagrid-club-model' /> | ||
|
||
**4.** Create an `ObservableCollection` in the `ViewModel` class: | ||
|
||
<snippet id='datagrid-column-view-model' /> | ||
|
||
> To learn more about defining columns and the different types of columns, you can take a look at the [Columns Section]({%slug datagrid-columns-overview%}). | ||
## Additional Resources | ||
|
||
- [.NET MAUI DataGrid Product Page](https://www.telerik.com/maui-ui/datagrid) | ||
- [.NET MAUI DataGrid Forum Page](https://www.telerik.com/forums/maui?tagId=1801) | ||
- [Telerik .NET MAUI Blogs](https://www.telerik.com/blogs/mobile-net-maui) | ||
- [Telerik .NET MAUI Roadmap](https://www.telerik.com/support/whats-new/maui-ui/roadmap) | ||
|
||
## See Also | ||
|
||
- [Filtering UI in the Telerik UI for .NET MAUI DataGrid]({%slug datagrid-filtering-ui%}) | ||
- [Programmatic Filtering in the DataGrid]({%slug datagrid-programmatic-filtering%}) | ||
- [Grouping in the DataGrid]({%slug datagrid-grouping-overview%}) | ||
- [Styling the Appearance of the DataGrid]({%slug datagrid-styling%}) |
8 changes: 5 additions & 3 deletions
8
controls/datagrid/datatable-support.md → ...populating-with-data/datatable-support.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.