Skip to content

finphie/WpfHosting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WpfHosting

NuGet Azure Artifacts

日本語 (Japanese)

Library for building WPF applications using Generic Host.

説明

A library for building WPF applications using Generic Host (Host.CreateEmptyApplicationBuilder).

Installation

NuGet (Stable Release)

dotnet add package WpfHosting

Azure Artifacts (Development Builds)

dotnet add package WpfHosting -s https://pkgs.dev.azure.com/finphie/Main/_packaging/DotNet/nuget/v3/index.json

Usage

Create 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();

Sample Project

Supported Frameworks

  • .NET 9
  • .NET 8

Author

finphie

License

MIT

Credits

This project uses the following libraries, etc.

Analyzers

Others

About

Library for building WPF applications using Generic Host.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages