Migrating from MVVM Model
Shows the difference between MVVM and MVU approach with a practical example
Component-Based UI vs View-ViewModel
.NET MAUI promotes the separation between the View (usually written in XAML) and the Model (usually written in C#). This pattern is called View-ViewModel and has been historically adopted by a lot of UI frameworks like WPF/SL, Angular, etc.
Recently Component based pattern has gained much popularity thanks to ReactJS and Flutter.
.NET MAUI View-ViewModel
Let's take for example a login page written in .NET MAUI composed of a MainPage (XAML) and a ViewModel MainPageViewModel (c#):
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="XamarinApp1.MainPage">
<StackLayout
VerticalOptions="Center"
HorizontalOptions="Center">
<Entry Placeholder="Username" Text="{Binding Username}" />
<Entry Placeholder="Password" Text="{Binding Password}" />
<Button Text="Login" Command="{Binding LoginCommand}" />
</StackLayout>
</ContentPage>ReactorUI Component-Based
Following is the same login page but written using MauiReactor:
Last updated
Was this helpful?