You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
This article demonstrates how to bind content to the [Blazor RichTextEditor](https://blazor.syncfusion.com/documentation/rich-text-editor/data-binding) in a .NET MAUI Hybrid application using a ViewModel. The approach ensures that any changes in the editor are reflected in the ViewModel, and those changes can be tracked and displayed within the `.NET MAUI UI`.
1
+
This article demonstrates how to bind content to the [Blazor RichTextEditor](https://www.syncfusion.com/blazor-components/blazor-rich-text-editor) in a .NET MAUI Hybrid application using a ViewModel. The approach ensures that any changes in the editor are reflected in the ViewModel, and those changes can be tracked and displayed within the `.NET MAUI UI`.
2
2
3
3
**ViewModel Implementation**
4
4
5
-
To begin, create a ViewModel that implements `INotifyPropertyChanged`. This will allow the UI to respond to changes in the data model.
5
+
To begin, create a ViewModel (e.g., `ViewModel.cs`) that implements `INotifyPropertyChanged`. This will allow the UI to respond to changes in the data model.
6
6
7
7
```csharp
8
8
publicclassViewModel : INotifyPropertyChanged
@@ -23,10 +23,12 @@ public class ViewModel : INotifyPropertyChanged
23
23
}
24
24
```
25
25
26
-
To complete the setup, ensure that the `ViewModel` is registered with the dependency injection container in the `.NET MAUI` application. This can be done in the `MauiProgram.cs` file:
26
+
To complete the setup, ensure the `ViewModel` is registered with the dependency injection container in the `.NET MAUI` application. This can be done in the `MauiProgram.cs` file:
27
27
28
28
```csharp
29
+
...
29
30
builder.Services.AddSingleton<ViewModel>();
31
+
...
30
32
```
31
33
32
34
This registration allows the `ViewModel` to be injected into both the Blazor components and the .NET MAUI pages.
@@ -73,7 +75,7 @@ In this code:
73
75
74
76
**MAUI Label Binding**
75
77
76
-
To display the content of the RichTextEditor in a MAUI Label, you can use the following XAML and C# code:
78
+
To display the content of the RichTextEditor in a MAUI Label, you can refer to the below code:
77
79
78
80
**XAML:**
79
81
```xml
@@ -84,17 +86,14 @@ To display the content of the RichTextEditor in a MAUI Label, you can use the fo
0 commit comments