Skip to content

Commit b816fc1

Browse files
Merge pull request #2 from SyncfusionExamples/Sample
Updated the README.md
2 parents dde8d67 + ebf8b2b commit b816fc1

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff 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`.
22

33
**ViewModel Implementation**
44

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.
66

77
```csharp
88
public class ViewModel : INotifyPropertyChanged
@@ -23,10 +23,12 @@ public class ViewModel : INotifyPropertyChanged
2323
}
2424
```
2525

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:
2727

2828
```csharp
29+
...
2930
builder.Services.AddSingleton<ViewModel>();
31+
...
3032
```
3133

3234
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:
7375

7476
**MAUI Label Binding**
7577

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:
7779

7880
**XAML:**
7981
```xml
@@ -84,17 +86,14 @@ To display the content of the RichTextEditor in a MAUI Label, you can use the fo
8486
```csharp
8587
public partial class MainPage : ContentPage
8688
{
87-
private readonly ViewModel _viewModel;
88-
8989
public MainPage(ViewModel viewModel)
9090
{
9191
InitializeComponent();
92-
_viewModel = viewModel;
9392
BindingContext = _viewModel;
9493
}
9594
}
9695
```
9796

9897
**Output**
9998

100-
![image.png](https://support.syncfusion.com/kb/agent/attachment/article/17109/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjI4MTc1Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.DOxJRcAi-FGxM6o3pB0PG0RYJtMpMGMAe25G-H0CTms)
99+
![RichTextEditor.png](https://support.syncfusion.com/kb/agent/attachment/article/17109/inline?token=eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjI4MTk5Iiwib3JnaWQiOiIzIiwiaXNzIjoic3VwcG9ydC5zeW5jZnVzaW9uLmNvbSJ9.7L4aGHuSSBIrh6LKfuQAXA6lKWbS85xx2DOJK746g_A)

0 commit comments

Comments
 (0)