[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DYNJPJAB22JJK3CX69MDNB":3,"skill-same:01M6DYNJPJAB22JJK3CX69MDNB":90},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":53,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":56,"updatedAt":57,"install":58,"resources":71},"01M6DYNJPJAB22JJK3CX69MDNB","mvvm",null,"Implement the Model-View-ViewModel pattern in .NET applications with proper separation of concerns, data binding, commands, and testable ViewModels using MVVM Toolkit. USE FOR: implementing UI separation with Model-View-ViewModel; using MVVM Toolkit (CommunityToolkit.Mvvm) for ViewModels; designing testable UI architecture. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","managedcode\u002Fdotnet-skills","managedcode","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F78253589?v=4","01M6DYDJR3EG8KB5G4PC65XCTT","Managed Code","01M6DYDJX0ZT432N04NYJW89DN",515,"MIT","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm\u002FSKILL.md",[],[5,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"when","architecture","implementing","inspect","relevant","uno platform","separation of concerns","commands","pattern","do","files","unrelated","context","edit","model","projects","mvvm toolkit","data","repository","ui","blazor","run","tasks","2026-11-10 10:12:30",false,"---\nname: mvvm\ndescription: \"Implement the Model-View-ViewModel pattern in .NET applications with proper separation of concerns, data binding, commands, and testable ViewModels using MVVM Toolkit. USE FOR: implementing UI separation with Model-View-ViewModel; using MVVM Toolkit (CommunityToolkit.Mvvm) for ViewModels; designing testable UI architecture. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.\"\ncompatibility: \"Applies to WPF, MAUI, WinUI, Uno Platform, Avalonia, and Blazor projects.\"\n---\n\n# MVVM Pattern for .NET\n\n## Trigger On\n\n- implementing UI separation with Model-View-ViewModel\n- using MVVM Toolkit (CommunityToolkit.Mvvm) for ViewModels\n- designing testable UI architecture\n- handling commands, property changes, and messaging\n- choosing between MVVM frameworks\n\n## Documentation\n\n- [MVVM Toolkit Overview](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002F)\n- [ObservableObject](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fobservableobject)\n- [RelayCommand](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Frelaycommand)\n- [Messenger](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fmessenger)\n- [Source Generators](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fgenerators\u002Foverview)\n\n## References\n\nSee detailed examples in the `references\u002F` folder:\n- [`patterns.md`](references\u002Fpatterns.md) — ViewModel, command, navigation, and state patterns\n- [`anti-patterns.md`](references\u002Fanti-patterns.md) — Common mistakes and how to fix them\n\n## Core Concepts\n\n| Component | Responsibility | Example |\n|-----------|---------------|---------|\n| **Model** | Business logic and data | `Product`, `Order`, `User` |\n| **View** | UI presentation (XAML\u002FRazor) | `ProductPage.xaml` |\n| **ViewModel** | UI logic and state | `ProductViewModel` |\n\n## Workflow\n\n1. **Keep Views dumb** — no business logic in code-behind\n2. **Use data binding** — connect View to ViewModel properties\n3. **Commands for actions** — handle user interactions via ICommand\n4. **Inject dependencies** — services go into ViewModel constructors\n5. **Test ViewModels** — they should be unit testable without UI\n\n## MVVM Toolkit Setup\n\n```xml\n\u003CPackageReference Include=\"CommunityToolkit.Mvvm\" Version=\"8.*\" \u002F>\n```\n\n## ViewModel Patterns\n\n### Basic ViewModel with Source Generators\n```csharp\npublic partial class ProductViewModel(IProductService productService) : ObservableObject\n{\n    [ObservableProperty]\n    private string _name = string.Empty;\n\n    [ObservableProperty]\n    private decimal _price;\n\n    [ObservableProperty]\n    [NotifyCanExecuteChangedFor(nameof(SaveCommand))]\n    private bool _isValid;\n\n    [RelayCommand(CanExecute = nameof(CanSave))]\n    private async Task SaveAsync()\n    {\n        await productService.SaveAsync(new Product { Name = Name, Price = Price });\n    }\n\n    private bool CanSave() => IsValid && !string.IsNullOrEmpty(Name);\n}\n```\n\n### Property Changed Notifications\n```csharp\npublic partial class OrderViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private int _quantity;\n\n    [ObservableProperty]\n    private decimal _unitPrice;\n\n    \u002F\u002F Computed property - manually notify\n    public decimal Total => Quantity * UnitPrice;\n\n    partial void OnQuantityChanged(int value)\n    {\n        OnPropertyChanged(nameof(Total));\n    }\n\n    partial void OnUnitPriceChanged(decimal value)\n    {\n        OnPropertyChanged(nameof(Total));\n    }\n}\n```\n\n### Collection ViewModel\n```csharp\npublic partial class ProductListViewModel(IProductService productService) : ObservableObject\n{\n    [ObservableProperty]\n    private ObservableCollection\u003CProductViewModel> _products = [];\n\n    [ObservableProperty]\n    private ProductViewModel? _selectedProduct;\n\n    [ObservableProperty]\n    private bool _isLoading;\n\n    [RelayCommand]\n    private async Task LoadProductsAsync()\n    {\n        IsLoading = true;\n        try\n        {\n            var items = await productService.GetAllAsync();\n            Products = new ObservableCollection\u003CProductViewModel>(\n                items.Select(p => new ProductViewModel(productService)\n                {\n                    Name = p.Name,\n                    Price = p.Price\n                }));\n        }\n        finally\n        {\n            IsLoading = false;\n        }\n    }\n\n    [RelayCommand]\n    private void DeleteProduct(ProductViewModel product)\n    {\n        Products.Remove(product);\n    }\n}\n```\n\n## Commands\n\n### Async Commands with Cancellation\n```csharp\npublic partial class SearchViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private string _searchText = string.Empty;\n\n    [RelayCommand(IncludeCancelCommand = true)]\n    private async Task SearchAsync(CancellationToken token)\n    {\n        await Task.Delay(500, token); \u002F\u002F Debounce\n        \u002F\u002F Search logic with cancellation support\n    }\n}\n```\n\n### Command with Parameter\n```csharp\npublic partial class NavigationViewModel : ObservableObject\n{\n    [RelayCommand]\n    private void NavigateTo(string page)\n    {\n        \u002F\u002F Navigate to page\n    }\n\n    [RelayCommand]\n    private async Task OpenItemAsync(int itemId)\n    {\n        \u002F\u002F Load and open item\n    }\n}\n```\n\n## Messenger Pattern\n\n### Sending Messages\n```csharp\n\u002F\u002F Define message\npublic record ProductSelectedMessage(Product Product);\n\n\u002F\u002F Send from one ViewModel\nWeakReferenceMessenger.Default.Send(new ProductSelectedMessage(selectedProduct));\n```\n\n### Receiving Messages\n```csharp\npublic partial class ProductDetailViewModel : ObservableRecipient\n{\n    public ProductDetailViewModel()\n    {\n        IsActive = true; \u002F\u002F Enable message reception\n    }\n\n    protected override void OnActivated()\n    {\n        Messenger.Register\u003CProductDetailViewModel, ProductSelectedMessage>(\n            this, (r, m) => r.LoadProduct(m.Product));\n    }\n\n    private void LoadProduct(Product product)\n    {\n        \u002F\u002F Update UI with product details\n    }\n}\n```\n\n## Validation\n\n### Using ObservableValidator\n```csharp\npublic partial class RegistrationViewModel : ObservableValidator\n{\n    [ObservableProperty]\n    [NotifyDataErrorInfo]\n    [Required(ErrorMessage = \"Email is required\")]\n    [EmailAddress(ErrorMessage = \"Invalid email format\")]\n    private string _email = string.Empty;\n\n    [ObservableProperty]\n    [NotifyDataErrorInfo]\n    [Required]\n    [MinLength(8, ErrorMessage = \"Password must be at least 8 characters\")]\n    private string _password = string.Empty;\n\n    [RelayCommand(CanExecute = nameof(CanRegister))]\n    private async Task RegisterAsync()\n    {\n        ValidateAllProperties();\n        if (HasErrors) return;\n\n        \u002F\u002F Registration logic\n    }\n\n    private bool CanRegister() => !HasErrors;\n}\n```\n\n## Dependency Injection\n\n### Registration\n```csharp\n\u002F\u002F Services\nservices.AddSingleton\u003CIProductService, ProductService>();\nservices.AddSingleton\u003CINavigationService, NavigationService>();\n\n\u002F\u002F ViewModels\nservices.AddTransient\u003CProductListViewModel>();\nservices.AddTransient\u003CProductDetailViewModel>();\n\n\u002F\u002F Views (for View-first navigation)\nservices.AddTransient\u003CProductListPage>();\nservices.AddTransient\u003CProductDetailPage>();\n```\n\n### ViewModel Locator Pattern\n```csharp\npublic class ViewModelLocator\n{\n    private static IServiceProvider _provider = null!;\n\n    public static void Initialize(IServiceProvider provider) => _provider = provider;\n\n    public ProductListViewModel ProductList => _provider.GetRequiredService\u003CProductListViewModel>();\n    public ProductDetailViewModel ProductDetail => _provider.GetRequiredService\u003CProductDetailViewModel>();\n}\n```\n\n## View Binding\n\n### XAML Binding\n```xml\n\u003CPage x:Class=\"MyApp.Views.ProductListPage\"\n      xmlns:vm=\"using:MyApp.ViewModels\"\n      x:DataType=\"vm:ProductListViewModel\">\n\n    \u003CGrid>\n        \u003CProgressRing IsActive=\"{x:Bind ViewModel.IsLoading, Mode=OneWay}\"\n                      Visibility=\"{x:Bind ViewModel.IsLoading, Mode=OneWay}\" \u002F>\n\n        \u003CListView ItemsSource=\"{x:Bind ViewModel.Products, Mode=OneWay}\"\n                  SelectedItem=\"{x:Bind ViewModel.SelectedProduct, Mode=TwoWay}\">\n            \u003CListView.ItemTemplate>\n                \u003CDataTemplate x:DataType=\"vm:ProductViewModel\">\n                    \u003CStackPanel>\n                        \u003CTextBlock Text=\"{x:Bind Name, Mode=OneWay}\" \u002F>\n                        \u003CTextBlock Text=\"{x:Bind Price, Mode=OneWay}\" \u002F>\n                    \u003C\u002FStackPanel>\n                \u003C\u002FDataTemplate>\n            \u003C\u002FListView.ItemTemplate>\n        \u003C\u002FListView>\n\n        \u003CButton Content=\"Load\"\n                Command=\"{x:Bind ViewModel.LoadProductsCommand}\" \u002F>\n    \u003C\u002FGrid>\n\u003C\u002FPage>\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Why It's Bad | Better Approach |\n|--------------|--------------|-----------------|\n| Logic in code-behind | Not testable | Move to ViewModel |\n| ViewModel knows View | Tight coupling | Use interfaces\u002Fmessaging |\n| Manual INotifyPropertyChanged | Verbose, error-prone | Use source generators |\n| God ViewModel | Unmaintainable | Split responsibilities |\n| Direct service calls in View | Violates separation | Go through ViewModel |\n| Exposing Model directly | Leaks implementation | Create ViewModel properties |\n\n## Testing ViewModels\n\n```csharp\npublic class ProductViewModelTests\n{\n    [Fact]\n    public async Task LoadProducts_PopulatesCollection()\n    {\n        \u002F\u002F Arrange\n        var mockService = new Mock\u003CIProductService>();\n        mockService.Setup(s => s.GetAllAsync())\n            .ReturnsAsync([new Product { Name = \"Test\", Price = 10 }]);\n\n        var viewModel = new ProductListViewModel(mockService.Object);\n\n        \u002F\u002F Act\n        await viewModel.LoadProductsCommand.ExecuteAsync(null);\n\n        \u002F\u002F Assert\n        Assert.Single(viewModel.Products);\n        Assert.Equal(\"Test\", viewModel.Products[0].Name);\n    }\n\n    [Fact]\n    public void SaveCommand_CannotExecute_WhenInvalid()\n    {\n        var viewModel = new ProductViewModel(Mock.Of\u003CIProductService>())\n        {\n            Name = \"\",\n            IsValid = false\n        };\n\n        Assert.False(viewModel.SaveCommand.CanExecute(null));\n    }\n}\n```\n\n## Framework Comparison\n\n| Feature | MVVM Toolkit | Prism | MVVMLight |\n|---------|--------------|-------|-----------|\n| Source generators | Yes | No | No |\n| Maintenance | Active | Active | Deprecated |\n| DI built-in | No | Yes | No |\n| Navigation | No | Yes | No |\n| Weight | Light | Heavy | Light |\n\n## Deliver\n\n- ViewModels that are fully unit testable\n- Clean separation between UI and business logic\n- Proper use of commands and data binding\n- Messaging for loose coupling between components\n\n## Validate\n\n- No business logic in code-behind files\n- ViewModels don't reference View types\n- Commands are used for all user actions\n- Properties use ObservableProperty or equivalent\n- Dependencies are injected, not created\n- Unit tests cover ViewModel logic\n","# MVVM Pattern for .NET\n\n## Trigger On\n\n- implementing UI separation with Model-View-ViewModel\n- using MVVM Toolkit (CommunityToolkit.Mvvm) for ViewModels\n- designing testable UI architecture\n- handling commands, property changes, and messaging\n- choosing between MVVM frameworks\n\n## Documentation\n\n- [MVVM Toolkit Overview](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002F)\n- [ObservableObject](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fobservableobject)\n- [RelayCommand](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Frelaycommand)\n- [Messenger](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fmessenger)\n- [Source Generators](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fcommunitytoolkit\u002Fmvvm\u002Fgenerators\u002Foverview)\n\n## References\n\nSee detailed examples in the `references\u002F` folder:\n- [`patterns.md`](references\u002Fpatterns.md) — ViewModel, command, navigation, and state patterns\n- [`anti-patterns.md`](references\u002Fanti-patterns.md) — Common mistakes and how to fix them\n\n## Core Concepts\n\n| Component | Responsibility | Example |\n|-----------|---------------|---------|\n| **Model** | Business logic and data | `Product`, `Order`, `User` |\n| **View** | UI presentation (XAML\u002FRazor) | `ProductPage.xaml` |\n| **ViewModel** | UI logic and state | `ProductViewModel` |\n\n## Workflow\n\n1. **Keep Views dumb** — no business logic in code-behind\n2. **Use data binding** — connect View to ViewModel properties\n3. **Commands for actions** — handle user interactions via ICommand\n4. **Inject dependencies** — services go into ViewModel constructors\n5. **Test ViewModels** — they should be unit testable without UI\n\n## MVVM Toolkit Setup\n\n```xml\n\u003CPackageReference Include=\"CommunityToolkit.Mvvm\" Version=\"8.*\" \u002F>\n```\n\n## ViewModel Patterns\n\n### Basic ViewModel with Source Generators\n```csharp\npublic partial class ProductViewModel(IProductService productService) : ObservableObject\n{\n    [ObservableProperty]\n    private string _name = string.Empty;\n\n    [ObservableProperty]\n    private decimal _price;\n\n    [ObservableProperty]\n    [NotifyCanExecuteChangedFor(nameof(SaveCommand))]\n    private bool _isValid;\n\n    [RelayCommand(CanExecute = nameof(CanSave))]\n    private async Task SaveAsync()\n    {\n        await productService.SaveAsync(new Product { Name = Name, Price = Price });\n    }\n\n    private bool CanSave() => IsValid && !string.IsNullOrEmpty(Name);\n}\n```\n\n### Property Changed Notifications\n```csharp\npublic partial class OrderViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private int _quantity;\n\n    [ObservableProperty]\n    private decimal _unitPrice;\n\n    \u002F\u002F Computed property - manually notify\n    public decimal Total => Quantity * UnitPrice;\n\n    partial void OnQuantityChanged(int value)\n    {\n        OnPropertyChanged(nameof(Total));\n    }\n\n    partial void OnUnitPriceChanged(decimal value)\n    {\n        OnPropertyChanged(nameof(Total));\n    }\n}\n```\n\n### Collection ViewModel\n```csharp\npublic partial class ProductListViewModel(IProductService productService) : ObservableObject\n{\n    [ObservableProperty]\n    private ObservableCollection\u003CProductViewModel> _products = [];\n\n    [ObservableProperty]\n    private ProductViewModel? _selectedProduct;\n\n    [ObservableProperty]\n    private bool _isLoading;\n\n    [RelayCommand]\n    private async Task LoadProductsAsync()\n    {\n        IsLoading = true;\n        try\n        {\n            var items = await productService.GetAllAsync();\n            Products = new ObservableCollection\u003CProductViewModel>(\n                items.Select(p => new ProductViewModel(productService)\n                {\n                    Name = p.Name,\n                    Price = p.Price\n                }));\n        }\n        finally\n        {\n            IsLoading = false;\n        }\n    }\n\n    [RelayCommand]\n    private void DeleteProduct(ProductViewModel product)\n    {\n        Products.Remove(product);\n    }\n}\n```\n\n## Commands\n\n### Async Commands with Cancellation\n```csharp\npublic partial class SearchViewModel : ObservableObject\n{\n    [ObservableProperty]\n    private string _searchText = string.Empty;\n\n    [RelayCommand(IncludeCancelCommand = true)]\n    private async Task SearchAsync(CancellationToken token)\n    {\n        await Task.Delay(500, token); \u002F\u002F Debounce\n        \u002F\u002F Search logic with cancellation support\n    }\n}\n```\n\n### Command with Parameter\n```csharp\npublic partial class NavigationViewModel : ObservableObject\n{\n    [RelayCommand]\n    private void NavigateTo(string page)\n    {\n        \u002F\u002F Navigate to page\n    }\n\n    [RelayCommand]\n    private async Task OpenItemAsync(int itemId)\n    {\n        \u002F\u002F Load and open item\n    }\n}\n```\n\n## Messenger Pattern\n\n### Sending Messages\n```csharp\n\u002F\u002F Define message\npublic record ProductSelectedMessage(Product Product);\n\n\u002F\u002F Send from one ViewModel\nWeakReferenceMessenger.Default.Send(new ProductSelectedMessage(selectedProduct));\n```\n\n### Receiving Messages\n```csharp\npublic partial class ProductDetailViewModel : ObservableRecipient\n{\n    public ProductDetailViewModel()\n    {\n        IsActive = true; \u002F\u002F Enable message reception\n    }\n\n    protected override void OnActivated()\n    {\n        Messenger.Register\u003CProductDetailViewModel, ProductSelectedMessage>(\n            this, (r, m) => r.LoadProduct(m.Product));\n    }\n\n    private void LoadProduct(Product product)\n    {\n        \u002F\u002F Update UI with product details\n    }\n}\n```\n\n## Validation\n\n### Using ObservableValidator\n```csharp\npublic partial class RegistrationViewModel : ObservableValidator\n{\n    [ObservableProperty]\n    [NotifyDataErrorInfo]\n    [Required(ErrorMessage = \"Email is required\")]\n    [EmailAddress(ErrorMessage = \"Invalid email format\")]\n    private string _email = string.Empty;\n\n    [ObservableProperty]\n    [NotifyDataErrorInfo]\n    [Required]\n    [MinLength(8, ErrorMessage = \"Password must be at least 8 characters\")]\n    private string _password = string.Empty;\n\n    [RelayCommand(CanExecute = nameof(CanRegister))]\n    private async Task RegisterAsync()\n    {\n        ValidateAllProperties();\n        if (HasErrors) return;\n\n        \u002F\u002F Registration logic\n    }\n\n    private bool CanRegister() => !HasErrors;\n}\n```\n\n## Dependency Injection\n\n### Registration\n```csharp\n\u002F\u002F Services\nservices.AddSingleton\u003CIProductService, ProductService>();\nservices.AddSingleton\u003CINavigationService, NavigationService>();\n\n\u002F\u002F ViewModels\nservices.AddTransient\u003CProductListViewModel>();\nservices.AddTransient\u003CProductDetailViewModel>();\n\n\u002F\u002F Views (for View-first navigation)\nservices.AddTransient\u003CProductListPage>();\nservices.AddTransient\u003CProductDetailPage>();\n```\n\n### ViewModel Locator Pattern\n```csharp\npublic class ViewModelLocator\n{\n    private static IServiceProvider _provider = null!;\n\n    public static void Initialize(IServiceProvider provider) => _provider = provider;\n\n    public ProductListViewModel ProductList => _provider.GetRequiredService\u003CProductListViewModel>();\n    public ProductDetailViewModel ProductDetail => _provider.GetRequiredService\u003CProductDetailViewModel>();\n}\n```\n\n## View Binding\n\n### XAML Binding\n```xml\n\u003CPage x:Class=\"MyApp.Views.ProductListPage\"\n      xmlns:vm=\"using:MyApp.ViewModels\"\n      x:DataType=\"vm:ProductListViewModel\">\n\n    \u003CGrid>\n        \u003CProgressRing IsActive=\"{x:Bind ViewModel.IsLoading, Mode=OneWay}\"\n                      Visibility=\"{x:Bind ViewModel.IsLoading, Mode=OneWay}\" \u002F>\n\n        \u003CListView ItemsSource=\"{x:Bind ViewModel.Products, Mode=OneWay}\"\n                  SelectedItem=\"{x:Bind ViewModel.SelectedProduct, Mode=TwoWay}\">\n            \u003CListView.ItemTemplate>\n                \u003CDataTemplate x:DataType=\"vm:ProductViewModel\">\n                    \u003CStackPanel>\n                        \u003CTextBlock Text=\"{x:Bind Name, Mode=OneWay}\" \u002F>\n                        \u003CTextBlock Text=\"{x:Bind Price, Mode=OneWay}\" \u002F>\n                    \u003C\u002FStackPanel>\n                \u003C\u002FDataTemplate>\n            \u003C\u002FListView.ItemTemplate>\n        \u003C\u002FListView>\n\n        \u003CButton Content=\"Load\"\n                Command=\"{x:Bind ViewModel.LoadProductsCommand}\" \u002F>\n    \u003C\u002FGrid>\n\u003C\u002FPage>\n```\n\n## Anti-Patterns to Avoid\n\n| Anti-Pattern | Why It's Bad | Better Approach |\n|--------------|--------------|-----------------|\n| Logic in code-behind | Not testable | Move to ViewModel |\n| ViewModel knows View | Tight coupling | Use interfaces\u002Fmessaging |\n| Manual INotifyPropertyChanged | Verbose, error-prone | Use source generators |\n| God ViewModel | Unmaintainable | Split responsibilities |\n| Direct service calls in View | Violates separation | Go through ViewModel |\n| Exposing Model directly | Leaks implementation | Create ViewModel properties |\n\n## Testing ViewModels\n\n```csharp\npublic class ProductViewModelTests\n{\n    [Fact]\n    public async Task LoadProducts_PopulatesCollection()\n    {\n        \u002F\u002F Arrange\n        var mockService = new Mock\u003CIProductService>();\n        mockService.Setup(s => s.GetAllAsync())\n            .ReturnsAsync([new Product { Name = \"Test\", Price = 10 }]);\n\n        var viewModel = new ProductListViewModel(mockService.Object);\n\n        \u002F\u002F Act\n        await viewModel.LoadProductsCommand.ExecuteAsync(null);\n\n        \u002F\u002F Assert\n        Assert.Single(viewModel.Products);\n        Assert.Equal(\"Test\", viewModel.Products[0].Name);\n    }\n\n    [Fact]\n    public void SaveCommand_CannotExecute_WhenInvalid()\n    {\n        var viewModel = new ProductViewModel(Mock.Of\u003CIProductService>())\n        {\n            Name = \"\",\n            IsValid = false\n        };\n\n        Assert.False(viewModel.SaveCommand.CanExecute(null));\n    }\n}\n```\n\n## Framework Comparison\n\n| Feature | MVVM Toolkit | Prism | MVVMLight |\n|---------|--------------|-------|-----------|\n| Source generators | Yes | No | No |\n| Maintenance | Active | Active | Deprecated |\n| DI built-in | No | Yes | No |\n| Navigation | No | Yes | No |\n| Weight | Light | Heavy | Light |\n\n## Deliver\n\n- ViewModels that are fully unit testable\n- Clean separation between UI and business logic\n- Proper use of commands and data binding\n- Messaging for loose coupling between components\n\n## Validate\n\n- No business logic in code-behind files\n- ViewModels don't reference View types\n- Commands are used for all user actions\n- Properties use ObservableProperty or equivalent\n- Dependencies are injected, not created\n- Unit tests cover ViewModel logic\n",{"name":5,"description":7,"compatibility":47},"Applies to WPF, MAUI, WinUI, Uno Platform, Avalonia, and Blazor projects.","main","497cc9aba79a931ac6fb8d36a48cc22fe3d6d74b","catalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm",41,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills","https:\u002F\u002Fskills.managed-code.com","https:\u002F\u002Fgithub.com\u002Fmanagedcode","https:\u002F\u002Fwww.managed-code.com","Open Source Community for .NET Developers: Reliable, Actively Maintained, and Community-Driven. Made in Ukraine 🇺🇦 with ❤️","2026-11-14 19:05:44",{"source":8,"skillName":5,"commands":59,"prompt":69,"zipAvailable":70},[60,63,66],{"tool":61,"command":62},"npx","npx skills add managedcode\u002Fdotnet-skills --skill mvvm",{"tool":64,"command":65},"bunx","bunx skills add managedcode\u002Fdotnet-skills --skill mvvm",{"tool":67,"command":68},"pnpm","pnpm dlx skills add managedcode\u002Fdotnet-skills --skill mvvm","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm\u002FSKILL.md",true,[72,78,82,86],{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"manifest.json","REFERENCE","参考文档",60,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm\u002Fmanifest.json",{"path":79,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fanti-patterns.md",6460,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm\u002Freferences\u002Fanti-patterns.md",{"path":83,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fpatterns.md",7037,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FMVVM-Toolkit\u002Fskills\u002Fmvvm\u002Freferences\u002Fpatterns.md",{"path":87,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Freview-output-template.md",2466,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fgithub\u002Fgithub-code-review\u002Freferences\u002Freview-output-template.md",[91,112,127,158,168,195],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":42},"01M6DYQE1Y9FHAQHEDTVFQ3447","xtwitter-scraper","Use XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API client usage; modeling API-key configuration, pagination, binary exports, raw responses, retries, and webhook\u002Fevent flows in .NET. DO NOT USE FOR: unrelated stacks; direct browser automation; generic social-media strategy; or code that does not call Xquik. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FXTwitterScraper\u002Fskills\u002Fxtwitter-scraper\u002FSKILL.md",[],[98,99,100,40,101,102,103,37,104,105,106,107,32,30,108,29,109,26,110,111],"xtwitter scraper","browser automation","workflows","code","browser","search","api","Media","api client","access","webhooks","social","modeling","webhook",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":42},"01M6DYQ9S4PE1H6G8MCH9T21HR","sep","Use Sep for high-performance separated-value parsing and writing in .NET, including delimiter inference, explicit parser\u002Fwriter options, and low-allocation row\u002Fcolumn workflows. USE FOR: delimited data needs are performance-sensitive and allocation-aware; project needs explicit control over separator inference, escaping, trimming, and header behavior;. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FSep\u002Fskills\u002Fsep\u002FSKILL.md",[],[114,119,120,100,41,40,37,36,121,122,32,31,30,29,28,123,124,125,26,126],"writing","performance","parsing","parser","writer","options","project","high-performance",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":42},"01M6DZS2DNEPXCGGF6SSCW6G5V","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fwebgpu-claude-skill\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,19],"webgpu","threejs","webgpu threejs tsl","setup","shaders","gpu","integration","applications","js","node","syntax","guide","use","language","three","compute","post","processing","with","renderer","for","materials","wgsl","effects",{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":42},"01M6DZS0BQXW2B56A289XF1X76","roslynk","Use Roslynk for semantic inspection and edits of *.cs, *.razor and *.cshtml solution files.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Froslynk\u002Fskills\u002Froslynk\u002FSKILL.md",[],[160,146,29,165,166,154,167],"semantic","razor","inspection",{"skillNo":169,"name":170,"nameZh":6,"description":171,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":42},"01M6DZRW6MEJCVW80K3S4XV60K","system-text-json-net11","Imperative guidance for the System.Text.Json APIs added in .NET 11: the built-in `JsonNamingPolicy.PascalCase` naming policy, and the strongly-typed generic `JsonSerializerOptions.GetTypeInfo` and `JsonSerializerOptions.TryGetTypeInfo` metadata accessors (generic overloads that return a typed `JsonTypeInfo`). USE ONLY when the user is targeting net11.0 or later and needs PascalCase JSON property or dictionary-key names without writing a custom naming policy, a strongly-typed generic `JsonTypeInfo` instead of the non-generic `JsonTypeInfo`, or a no-throw way to probe whether a type's serialization metadata is resolved. DO NOT USE when the target is earlier than net11.0, the requested behavior uses an established pre-net11 naming policy, or the user explicitly selected another JSON library.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[175,176,177,178,119,179,180,181,182,183,184,146,185,186,187,188,28,189,190,191,192,154,193,194,19],"system","json","text","system text json net11","policy","metadata","library","serialization","behavior","user","only","probe","guidance","later","type","dictionary","naming","targeting","custom","generic",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":201,"publishedAt":42},"01M6DZRRJP3S662NFSG1RSPQQ7","process-api-net11","Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText\u002FBytes\u002FLines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fprocess-api-net11\u002FSKILL.md",[],[104,202,203,204,40,205,141,175,146,187,188,28,206,207,208,209,192,154,210],"process","process api net11","diagnostics","start","basic","processes","output","usage","new"]