Skip to content

MVVM Building Blocks for WinUI and WPF Development Sample Code - .NET Conf 2024

License

Notifications You must be signed in to change notification settings

michael-hawker/MVVMNetConfApp

Repository files navigation

MVVM Building Blocks for WinUI and WPF Development

This is the completed code sample shown during the "MVVM Building Blocks for WinUI and WPF Development" .NET Conf 2024 talk:

YouTube Video - MVVM Building Blocks for WinUI and WPF Developent

The majority of this code was added live during the talk, so you can follow-along! Just copy the modified starting XAML contents in MVVMNetConfApp.Wpf/MainWindow.xaml to a new WPF app to get started!

Overview

The talk and code go over the benefits of the MVVM pattern, how to simplify implementing it with the MVVM Toolkit, and how the MVVM pattern can be used to architecture your application to:

  • Separate concerns
  • Re-use code
  • Abstract platform behavior
  • Make testing easier
  • Separate design and development

Code parts

  1. This project was constructed from file->new templates, starting with WPF.

  2. We then added some preliminary XAML in the initial commit to the MainWindow.xaml file.

  3. We added the new .NET 9 theming support for WPF.

  4. We add a new class library for ViewModels and start using the MVVM Toolkit source generators.

  5. We show how to add a unit test project and use .NET unit testing directly.

  6. We then show how to use the same XAML in WinUI, leverage our existing abstracted code with the MVVM pattern, and then update to use x:Bind for better performance at compile time and to be able to leverage Native AOT support (outside the scope of this talk/demo).

Further Resources

Learn more about Windows native development here

For the latest information on choosing between WPF and WinUI, see the Ignite talk "BRK305: Navigating Win32 App Development with WPF and WinUI":

Navigating Win32 App Development with WPF and WinUI | BRK305

For the latest with WinUI, see the "What's new in WinUI and Windows App SDK 1.6":

What's new in WinUI and Windows App SDK 1.6

For the latest with WPF, see "Empowering WPF Developers - WPF in .NET 9":

Empowering WPF Developers - WPF in .NET 9

About

MVVM Building Blocks for WinUI and WPF Development Sample Code - .NET Conf 2024

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages