/uno-platform:uno-mvvmfrom uno-platform
Uno Platform MVVM with CommunityToolkit.Mvvm: ObservableObject, ObservableProperty partial properties, RelayCommand, async commands, DI, x:Bind, and Uno Navigation from ViewModels.
Ships in uno-platform. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill only when the app's selected update model is MVVM.
MVVM in Uno Platform means mutable ViewModel classes, usually built with CommunityToolkit.Mvvm, bound from the UI through generated observable properties and generated commands. Do not drift into MVUX (partial record, IFeed<T>, IState<T>, generated *ViewModel from *Model) unless the user explicitly changes the update model.
uno-csharpmarkup2 for syntax and only apply the ViewModel/command concepts from this skill.Page, Button, TextBox, DispatcherQueue, or direct visual tree access in ViewModels unless a platform boundary genuinely requires it.Before adding MVVM code, inspect the app project:
Mvvm is present in <UnoFeatures> or that CommunityToolkit.Mvvm is otherwise referenced.[ObservableProperty] on partial properties, use .NET 9 SDK or newer and set <LangVersion>preview</LangVersion>.Navigation is present in <UnoFeatures> and .UseNavigation(RegisterRoutes) is configured..ConfigureServices(...).Do not add MVUX packages or MVUX features for an MVVM app.
Use ObservableObject plus source-generator attributes on partial properties. Do not use the older field annotation pattern for new Uno MVVM code.
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Uno.Extensions.Navigation;
public sealed partial class ProfileViewModel : ObservableObject
{
readonly INavigator navigator;
readonly IProfileService profileService;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(DisplayName))]
public partial string? Name { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanSave))]
public partial bool IsLoading { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasError))]
public partial string? ErrorMessage { get; set; }
public string DisplayName => string.IsNullOrWhiteSpace(Name) ? "Guest" : Name;
public bool CanSave => !IsLoading;
public bool HasError => !string.IsNullOrWhiteSpace(ErrorMessage);
public ProfileViewModel(INavigator navigator, IProfileService profileService)
{
this.navigator = navigator;
this.profileService = profileService;
}
[RelayCommand]
async Task SaveAsync(CancellationToken cancellationToken)
{
IsLoading = true;
ErrorMessage = null;
try
{
await profileService.SaveAsync(Name, cancellationToken);
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
finally
{
IsLoading = false;
}
}
[RelayCommand]
Task OpenDetailsAsync() =>
navigator.NavigateViewModelAsync<ProfileDetailsViewModel>(this);
}
Rules:
partial ViewModel classes so CommunityToolkit generators can emit properties and commands.[ObservableProperty] public partial T Name { get; set; } for mutable UI state.get and set; do not use init.[NotifyPropertyChangedFor] for dependent computed properties.[RelayCommand] / [AsyncRelayCommand] patterns instead of hand-written ICommand unless the app already has a command convention.CancellationToken parameters on async relay-command methods when the operation can be cancelled.If existing code uses [ObservableProperty] on fields, convert it to partial properties. Microsoft Toolkit diagnostics recommend this for developer experience, analyzer/source-generator visibility, and WinRT/WinUI AOT compatibility.
Generated observable properties support partial hooks:
partial void OnNameChanged(string? value)
{
ErrorMessage = null;
}
Use hooks for local state updates only. Avoid calling network APIs or navigation from property-change hooks; use commands for those actions.
Prefer x:Bind when the page exposes a strongly typed ViewModel property.
<TextBox Text="{x:Bind ViewModel.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text="{x:Bind ViewModel.DisplayName, Mode=OneWay}" />
<ProgressRing IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
<Button Content="Save"
Command="{x:Bind ViewModel.SaveCommand}"
IsEnabled="{x:Bind ViewModel.CanSave, Mode=OneWay}" />
<Button Content="Details"
Command="{x:Bind ViewModel.OpenDetailsCommand}" />
Uno-specific binding rules:
x:Bind defaults to OneTime; set Mode=OneWay for updating display state and Mode=TwoWay for editable input.UpdateSourceTrigger=PropertyChanged.Visibility is supported implicitly in Uno bindings.StringFormat, x:Static, or {x:Reference}.Run elements or expose a computed ViewModel property.DataTemplate, set x:DataType when using x:Bind; otherwise use ordinary {Binding} where the template scope requires it.Prefer a computed ViewModel property over converter stacks:
public string StatusText => IsLoading ? "Saving..." : "Ready";
<TextBlock Text="{x:Bind ViewModel.StatusText, Mode=OneWay}" />
When an item template needs to call a page-level ViewModel command, do not put click handlers in code-behind.
Use the app's established pattern:
x:Bind to the page ViewModel when the page is in scope.AncestorBinding / ItemsControlBinding when a template needs an ancestor DataContext.CommandParameter for the item.XAML shape:
<ListView ItemsSource="{x:Bind ViewModel.Items, Mode=OneWay}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="models:Customer">
<Button Content="{x:Bind Name}"
Command="{Binding DataContext.OpenCustomerCommand, ElementName=CustomersList}"
CommandParameter="{x:Bind}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
If ElementName binding is unreliable in the current Uno target, use Uno Toolkit ancestor-binding helpers instead of code-behind handlers.
Use constructor injection for ViewModels and services.
.ConfigureServices((context, services) =>
{
services.AddSingleton<IProfileService, ProfileService>();
services.AddTransient<ProfileViewModel>();
services.AddTransient<ProfileDetailsViewModel>();
})
Rules:
App.Host.Services.GetService<T>() inside ViewModels.TryAdd* only for reusable libraries that provide overridable defaults; app-level registrations should usually use Add*.With Uno Extensions Navigation, inject INavigator into the ViewModel and navigate from commands.
[RelayCommand]
Task ShowOrderAsync(Order order) =>
navigator.NavigateViewModelAsync<OrderDetailsViewModel>(this, data: order);
Route registration must include the ViewModel and data shape:
views.Register(
new ViewMap<OrdersPage, OrdersViewModel>(),
new DataViewMap<OrderDetailsPage, OrderDetailsViewModel, Order>());
Rules:
DataViewMap<TView, TViewModel, TData> when passing typed data.NavigateRouteAsync(this, "-/Login") for sibling-route navigation when NavigateViewModelAsync resolves only within the current child scope.Use explicit state properties so UI can bind without inspecting task internals.
[ObservableProperty]
public partial bool IsLoading { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(HasError))]
public partial string? ErrorMessage { get; set; }
public bool HasError => !string.IsNullOrWhiteSpace(ErrorMessage);
For validation:
For mutable lists, use ObservableCollection<T> or an existing app-specific observable collection pattern.
public ObservableCollection<Customer> Customers { get; } = [];
Rules:
ObservableCollection<T> on the UI thread.ListView/GridView virtualization or ItemsRepeater with an appropriate layout; do not wrap ListView in ScrollViewer.Use MVVM when:
Do not introduce:
partial record *Model as the page state owner.IFeed<T>, IState<T>, IListFeed<T>, or IListState<T>.Those belong to the Studio MVUX skills and only apply when the update model is MVUX.
ObservableObject or the app's established MVVM base.[ObservableProperty] on partial properties, not fields.get; set;, no implementation body, and no init.CommunityToolkit.Mvvm attributes.IsLoading stuck.INavigator are constructor-injected.DataViewMap and constructor injection.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub vincenth-net/dotnet-agentic-engineering --plugin uno-platform9 skills in this plugin
/uno-agentic-supportIn-app support for agentic development of Uno Platform apps. Use when running or preparing a Uno Platform app for agent-driven execution with uno_app_start. Also use when the expected log file specified in AGENT_CONSOLE_LOG is missing or lacks "uno-agentic-support" entry, or Hot Reload / Hot Design remains visible during agent UI testing./uno-csharpmarkup2Build or edit Uno Platform 6 UI in declarative C# with C# Markup 2 (CSharpForMarkup), instead of XAML. Use for Uno 6 apps on .NET 10/9 with MVVM or MVUX, Uno Extensions Navigation/Toolkit, and supported C# Markup 2 integrations such as LiveCharts2, ScottPlot, and Mapsui./uno-fluent2