Library for building WPF applications using Generic Host.
A library for building WPF applications using Generic Host (Host.CreateEmptyApplicationBuilder).
dotnet add package WpfHostingdotnet add package WpfHosting -s https://pkgs.dev.azure.com/finphie/Main/_packaging/DotNet/nuget/v3/index.jsonCreate App.xaml and App.xaml.cs and write the following:
<Application x:Class="WpfHosting.Sample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
</Application>using System.Windows;
public sealed partial class App : Application;Create MainWindow.xaml and MainWindow.xaml.cs and write the following:
<Window x:Class="WpfHosting.Sample.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="WpfHosting.Sample" Height="450" Width="800">
</Window>using System.Windows;
public sealed partial class MainWindow : Window
{
public MainWindow(MainWindowViewModel viewModel)
{
InitializeComponent();
DataContext = viewModel;
}
}Create Program.cs and write the following:
using WpfHosting;
var builder = WpfApp.CreateBuilder<App, MainWindow>();
var app = builder.Build();
app.Run();- .NET 9
- .NET 8
finphie
MIT
This project uses the following libraries, etc.