Skip to content
ScarletKuro edited this page Feb 15, 2026 · 2 revisions

Welcome to the Microsoft.Extensions.Hosting.Wpf wiki!

An unofficial implementation of Microsoft.Extensions.Hosting for WPF applications. This library brings the power of the .NET Generic Host to WPF, enabling dependency injection, configuration, logging, and hosted services in your desktop applications.

Key Features

  • Generic Host integration for WPF applications
  • ViewModel Locator pattern for binding DataContext directly in XAML via DI
  • Constructor injection in your App class
  • System tray icon support (optional extension)
  • Thread switching between UI and background threads (optional extension)
  • 3rd-party DI container support (SimpleInjector, Autofac, etc.)
  • Multi-target framework support: .NET Framework 4.6.2/4.8, .NET Core 3.1, .NET 6/7/8

Table of Contents

  1. Introduction
  2. NuGet Packages
  3. Getting Started
  4. ViewModelLocator Feature
  5. Constructor Injection in App
  6. WPF Lifetime
  7. Threading Extension
  8. TrayIcon Extension
  9. Bootstrap Extension (3rd-party DI)
  10. Architecture & How It Works
  11. API Reference
  12. Samples Overview
  13. FAQ & Troubleshooting

Quick Links

Clone this wiki locally