|
| 1 | +--- |
| 2 | +title: Events |
| 3 | +page_title: .NET MAUI TreeDataGrid Documentation - Events |
| 4 | +description: Learn about the Telerik UI for .NET MAUI TreeDataGrid events and how to achieve various scenarios upon user interaction such as loading content on demand, binding to data, and more. |
| 5 | +position: 14 |
| 6 | +tags: events |
| 7 | +slug: treedatagrid-events |
| 8 | +--- |
| 9 | + |
| 10 | +# .NET MAUI TreeDataGrid Events |
| 11 | + |
| 12 | +The [Telerik UI for .NET MAUI TreeDataGrid]({%slug datagrid-overview%}) component inherits the events from the [DataGrid]({%slug datagrid-overview%}) control a set of events which help users achieve seamless and effective experience when interacting with the component. |
| 13 | + |
| 14 | +## Loading Content on Demand |
| 15 | + |
| 16 | +The load-on-demand feature gets implemented through the `LoadOnDemand` event. The `LoadOnDemand` event handler receives the following parameters: |
| 17 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 18 | +* A `LoadOnDemandEventArgs` object, which provides the `IsDataLoaded` (`bool`) property, indicating whether the data is loaded. |
| 19 | + |
| 20 | +For more information, see the topic about [loading data on demand in the .NET MAUI TreeDataGrid]({%slug datagrid-features-loadondemand%}). |
| 21 | + |
| 22 | +## Loading Distinct Values |
| 23 | + |
| 24 | +The TreeDataGrid enables you to load the distinct values that will be displayed in the `Telerik.Maui.Controls.DataGrid.DataGridDistinctValuesFilterView` through the `DistinctValuesLoading` event. The `DistinctValuesLoading` event handler receives the following parameters: |
| 25 | + |
| 26 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 27 | +* A `DistinctValuesLoadingEventArgs` object, which provides the following properties: |
| 28 | + - `DistinctValues`—Specifies a list of values of type `IEnumerable` which are to be displayed in the `DataGridDistinctValuesFilterView`. |
| 29 | + - (Read-only) `Column` of type `DataGridColumn`—Gets the column for which the distinct values are being loaded. |
| 30 | + |
| 31 | +For more information, see the topic about the [available filtering options in the .NET MAUI TreeDataGrid]({%slug treedatagrid-filtering-overview%}). |
| 32 | + |
| 33 | +## Binding to Data |
| 34 | + |
| 35 | +The TreeDataGrid also gives you the option to use the `DataBindingComplete` event which occurs when the associated TreeDataGrid `ItemsSource` has been successfully bound to the control, or when any data operation like grouping, sorting, or filtering is applied. The `DataBindingComplete` event handler receives the following parameters: |
| 36 | + |
| 37 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 38 | +* A `DataBindingCompleteEventArgs` object, which provides the `DataView` (`IDataViewCollection`) property and allows for traversing and/or manipulating the already computed data view. |
| 39 | + |
| 40 | +## Modifying the Selection |
| 41 | + |
| 42 | +The TreeDataGrid inherits the `SelectionChanged` event which is triggered whenever the `SelectedItems` collection is changed. The `SelectionChanged` event handler receives the following parameters: |
| 43 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 44 | +* A `DataGridSelectionChangedEventArgs` object, which provides the following properties: |
| 45 | + - `RemovedItems`—Gets a list of the removed items from the `SelectedItems` collection. |
| 46 | + - `AddedItems`—Gets a list of the added items to the `SelectedItems` collection. |
| 47 | + |
| 48 | +For more information, see the article about the [`SelectionChanged` event of the .NET MAUI TreeDataGrid]({%slug treedatagrid-selection-overview%}). |
| 49 | + |
| 50 | +## Changing the Current Cell |
| 51 | + |
| 52 | +The TreeDataGrid also supports the `CurrentCellChanged` event which is invoked when the current cell changes. The `CurrentCellChanged` event handler receives the following parameters: |
| 53 | + |
| 54 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 55 | +* A `CurrentCellChangedEventArgs` object, which provides the following properties: |
| 56 | + - `OldCurrentCell`—Gets the previously `CurrentCell`. |
| 57 | + - `NewCurrentCell`—Gets the new `CurrentCell`. |
| 58 | + |
| 59 | +For more information, see the article about the [`CurrentCellChanged` event in the .NET MAUI TreeDataGrid]({%slug treedatagrid-current-cell%}). |
| 60 | + |
| 61 | +## Reordering the Column |
| 62 | + |
| 63 | +The TreeDataGrid inherits the `ColumnReorderStarting`, `ColumnReordering`, `ColumnReorderCompleting`, and `ColumnReordered` events related to the column reordering operation. For more details, review the TreeDataGrid [Columns Reordering]({%slug treedatagrid-columns-reordering%}#events) article. |
| 64 | + |
| 65 | +## Resizing the Column |
| 66 | + |
| 67 | +The TreeDataGrid resizing feature exposes a `ColumnUserResizeCompleted` event which is invoked when a column is resized by user interaction. The `ColumnUserResizeCompleted` event handler receives the following parameters: |
| 68 | +* The `sender` argument, which is of type `object`, but can be cast to the `RadDataGrid` type. |
| 69 | +* A `ColumnUserResizeCompletedEventArgs` object, which provides the following properties: |
| 70 | + - `Column` (`DataGridColumn`)—Gets the previously `CurrentCell`. |
| 71 | + - `Width` (`double`)—Gets the width of the column that is resized. |
| 72 | + |
| 73 | +## Additional Resources |
| 74 | + |
| 75 | +- [.NET MAUI TreeDataGrid Product Page](https://www.telerik.com/maui-ui/treedatagrid) |
| 76 | +- [.NET MAUI TreeDataGrid Forum Page](https://www.telerik.com/forums/maui?tagId=1801) |
| 77 | +- [Telerik .NET MAUI Blogs](https://www.telerik.com/blogs/mobile-net-maui) |
| 78 | +- [Telerik .NET MAUI Roadmap](https://www.telerik.com/support/whats-new/maui-ui/roadmap) |
| 79 | + |
| 80 | +## See Also |
| 81 | + |
| 82 | +- [Setting the .NET MAUI TreeDataGrid Columns]({%slug treedatagrid-columns-overview%}) |
| 83 | +- [Using the TreeDataGrid Commands]({%slug treedatagrid-aggregates%}) |
| 84 | +- [Styling the Appearance of the TreeDataGrid]({%slug treedatagrid-styling%}) |
| 85 | + |
0 commit comments