Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Implements Model-View-ViewModel in .NET apps using MVVM Toolkit (CommunityToolkit.Mvvm) for ViewModels, commands, and messaging.
Use this skill ↓86% 91%+5 ptsof test cases passed
Passed 20 of 22 test cases with the skill, and 19 of 22 without it.
Write a XAML snippet for a page displaying a list of products and a refresh button, using high-performance compiled bindings referencing a ProductListViewModel.
Uses x:Bind syntax for data binding
3 of 3 safety checks passed
// MainPage.xaml.cs
public partial class MainPage : Page
{
private async void SaveButton_Click(object sender, RoutedEventArgs e)
{
var service = new ProductService(); // Direct instantiation
await service.SaveAsync(new Product
{
Name = NameTextBox.Text,
Price = decimal.Parse(PriceTextBox.Text)
});
MessageBox.Show("Saved!");
}
}
// MainPage.xaml.cs
public partial class MainPage : Page
{
public MainPage(MainViewModel viewModel)
{
InitializeComponent();
DataContext = viewModel;
}
}
// MainViewModel.cs
public partial class MainViewModel(IProductService productService) : ObservableObject
{
[RelayCommand]
private async Task SaveAsync()
{
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.