Skip to content

Commit 75a5fb3

Browse files
committed
updates in articles
1 parent 955ffc3 commit 75a5fb3

File tree

4 files changed

+87
-52
lines changed

4 files changed

+87
-52
lines changed

controls/treedatagrid/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ In some cases, you may need to [load data in the .NET MAUI TreeDataGrid when the
4747

4848
## Row Details
4949

50-
The MAUI TreeDataGrid allows you to represent additional information for the data in the row by using the [row details]({%slug treedatagrid-row-details-overview%}) feature.
50+
The MAUI TreeDataGrid allows you to represent additional information for the data in the row by using the [row details]({%slug treedatagrid-row-details%}) feature.
5151

5252
## Search As You Type
5353

controls/treedatagrid/populating-with-data/datatable-support.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,6 @@ The [.NET MAUI TreeDataGrid]({%slug datagrid-overview%}) provides full and seaml
1313

1414
The component enables you to bind it to the DataTable and you can also add, remove, select, and edit DataGrid items, and update the TreeDataGrid `ItemsSource`. All available TreeDataGrid commands and operations, like filtering, sorting, and selection, are fully functioning when the DataGrid is bound to a DataTable.
1515

16-
## Binding
17-
18-
The following example shows a sample TreeDataGrid `ItemsSource` binding to a DataTable:
19-
20-
**1.** Define the TreeDataGrid.
21-
22-
<snippet id='datagrid-datatable-binding'/>
23-
24-
**2.** Add the namespace.
25-
26-
```XAML
27-
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
28-
```
29-
30-
**3.** Set the `ViewModel`.
31-
32-
<snippet id='datagrid-datatable-viewmodel'/>
33-
34-
> For a full data-binding implementation of a DataGrid to a DataTable, see the `DataGrid/DataTable` folder of the [SDKBrowser Demo Application]({%slug sdkbrowser-app%}).
35-
3616
## Filtering and Sorting
3717

3818
When using a DataTable, you can filter and sort the data inside the TreeDataGrid through the UI or programmatically.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: Binding to Dynamic Data
3+
page_title: .NET MAUI TreeDataGrid Documentation - Dynamic Data
4+
description: Learn how to bind the Telerik UI for .NET MAUI TreeDataGrid to different types of dynamic data - expando and dynamic objects.
5+
position: 2
6+
slug: treedatagrid-dynamic-data
7+
tags: binding, dynamic, data, expando, dynamic object, dotnet maui, maui, datagrid
8+
---
9+
10+
# .NET MAUI TreeDataGrid Data Binding: Binding to Dynamic Data
11+
12+
As of Telerik UI for .NET MAUI 6.8.0, the [.NET MAUI TreeDataGrid]({%slug treedatagrid-overview%}) supports binding to any type that implements the standard `IDynamicMetaObjectProvider` DLR interface, such as `DynamicObject` and `ExpandoObject`.
13+
14+
Using Dynamic Data enables you to filter and sort the data inside the DataGrid both through the UI and programmatically.
15+
16+
## Executing Dynamic Data on iOS and MacCatalyst
17+
18+
When you develop applications for Apple devices and plan to bind the DataGrid to dynamic data, you must consider the <a href = "https://learn.microsoft.com/en-us/dotnet/maui/macios/interpreter?view=net-maui-8.0&source=recommendations" target="_blank">security restrictions set by Apple</a>. These restrictions disallow the execution of dynamically generated code on a device. As a result, apps that use `DynamicObject` or `ExpandoObject` will crash in a release build for iOS and Mac Catalyst with a `System.ExecutionEngineException`.
19+
To prevent the exception, use the `MtouchInterpreter` <a href = "https://learn.microsoft.com/en-us/dotnet/maui/macios/interpreter?view=net-maui-8.0&source=recommendations#enable-the-interpreter" target="_blank"> as recommended by Microsoft</a>.
20+
21+
```xml
22+
<PropertyGroup Condition="'$(Configuration)|$(RuntimeIdentifier)'=='Release|maccatalyst-arm64'">
23+
<MtouchInterpreter>-all,+Telerik.Maui.Controls.dll</MtouchInterpreter>
24+
</PropertyGroup>
25+
```
26+
27+
For more information about these limitations and the suggested solution, see Microsoft's <a href = "https://learn.microsoft.com/en-us/dotnet/maui/macios/interpreter?view=net-maui-8.0&source=recommendations" target="_blank">Mono interpreter on iOS and Mac Catalyst</a> article.
28+
29+
## Binding to DynamicObject
30+
31+
The following example shows how to implement a `DynamicObject` class with Dynamic Language Runtime (DLR) and Common Language Runtime (CLR) fields and bind it to the TreeDataGrid. The standard CLR properties registered in the dynamic type must be exposed through the DLR API.
32+
33+
The model shows a class that derives from `DynamicObject` and contains a CLR property called `Id`. When the DataGrid auto-generates its columns, the `TryGetMember` method of the `DynamicObject` class will be used to fetch the values for each column. You must also implement a specific logic in the method to allow `RadTreeDataGrid` to work with both CLR and DLR data.
34+
35+
**1.** Add the model for the TreeDataGrid:
36+
37+
<snippet id='treedatagrid-dynamicobject-model' />
38+
39+
**2.** Define the `ViewModel`:
40+
41+
<snippet id='treedatagrid-dynamicobject-viewmodel' />
42+
43+
**3.** Define the `RadTreeDataGrid`:
44+
45+
<snippet id='treedatagrid-dynamicobject' />
46+
47+
**4.** Add the `telerik` namespace:
48+
49+
```XAML
50+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
51+
```
52+
53+
This is the result:
54+
55+
56+
## Binding to ExpandoObject
57+
58+
**1.** Define the `RadTreeDataGrid` control in XAML:
59+
60+
<snippet id='treedatagrid-expandoobject' />
61+
62+
**2.** Add the `telerik` namespace:
63+
64+
```XAML
65+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
66+
```
67+
68+
**3.** Define the `ViewModel`:
69+
70+
<snippet id='treedatagrid-expandoobject-viewmodel' />
71+
72+
This is the result:
73+
74+
75+
## Additional Resources
76+
77+
- [.NET MAUI TreeDataGrid Product Page](https://www.telerik.com/maui-ui/treedatagrid)
78+
- [.NET MAUI TreeDataGrid Forum Page](https://www.telerik.com/forums/maui?tagId=1801)
79+
- [Telerik .NET MAUI Blogs](https://www.telerik.com/blogs/mobile-net-maui)
80+
- [Telerik .NET MAUI Roadmap](https://www.telerik.com/support/whats-new/maui-ui/roadmap)
81+
82+
## See Also
83+
84+
- [Filtering UI in the Telerik UI for .NET MAUI TreeDataGrid]({%slug treedatagrid-filtering-ui%})
85+
- [Programmatic Filtering in the TreeDataGrid]({%slug treedatagrid-programmatic-filtering%})
86+
- [Styling the Appearance of the TreeDataGrid]({%slug treedatagrid-styling%})

controls/treedatagrid/row-height.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)