Lesson 23 of 40 Desktop Intermediate 45 min

WPF Desktop Applications

Build modern Windows desktop apps with WPF in .NET 10 — MVVM pattern, data binding, styles, animations, and Windows 11 design language.

Part 1: MVVM with Community Toolkit

[ObservableObject]
public partial class MainWindowViewModel
{
  [ObservableProperty]
  private ObservableCollection<Order> _orders = [];

  [RelayCommand]
  private async Task LoadOrdersAsync() =>
    Orders = [..await _service.GetAllAsync()];
}

Part 2: Data Binding Deep Dive

<!-- Two-way binding with validation -->
<TextBox Text="{Binding CustomerName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>

<!-- CommandBinding -->
<Button Content="Save" Command="{Binding SaveCommand}"/>

Part 3: Styles and Control Templates

<Style TargetType="Button" x:Key="PrimaryButton">
  <Setter Property="Background" Value="#0078D4"/>
  <Style.Triggers>
    <Trigger Property="IsMouseOver" Value="True">
      <Setter Property="Background" Value="#1890F1"/>
    </Trigger>
  </Style.Triggers>
</Style>

Part 4: Windows App SDK Integration

WPF in .NET 10 integrates with Windows App SDK for modern UI elements:
  • WinUI 3 controls (NumberBox, InfoBar, ProgressRing)
  • Mica/Acrylic materials for Windows 11 look
  • System backdrop APIs
  • Notification APIs
VISUAL STUDIO 2026 MADE EASY
Recommended Book

VISUAL STUDIO 2026 MADE EASY

Build real applications with C#, VB.NET, Python, JavaScript, C++, and .NET 10. A practical companion for mastering Visual Studio 2026 step by step.