WpfHosting 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WpfHosting --version 0.1.0                
NuGet\Install-Package WpfHosting -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WpfHosting" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WpfHosting --version 0.1.0                
#r "nuget: WpfHosting, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WpfHosting as a Cake Addin
#addin nuget:?package=WpfHosting&version=0.1.0

// Install WpfHosting as a Cake Tool
#tool nuget:?package=WpfHosting&version=0.1.0                

WpfHosting

Build(.NET) NuGet

WPFアプリケーションの構築を行うライブラリです。

説明

Minimal APIとMicrosoft.Extensions.DependencyInjectionを使用したWPFアプリケーションの構築を行うライブラリです。

インストール

NuGet(正式リリース版)

dotnet add package WpfHosting

Azure Artifacts(開発用ビルド)

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

使い方

App.xamlとApp.xaml.csを作成して次のように記述します。

<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>
public partial class App : Application
{
    public App() => InitializeComponent();
}

ShellWindow.xamlとShellWindow.xaml.csを作成して次のように記述します。

<Window x:Class="WpfHosting.Sample.Views.ShellWindow"
        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>
public sealed partial class ShellWindow
{
    public ShellWindow(ShellViewModel viewModel)
    {
        InitializeComponent();
        DataContext = viewModel;
    }
}

Program.csファイルを作成して次のように記述します。

using WpfHosting;
using WpfHosting.Sample;
using WpfHosting.Sample.Views;

var app = WpfApp.CreateDefaultBuilder()
    .UseWpfApp<App, ShellWindow>()
    .Build();

app.Run();

サンプルプロジェクト

サポートフレームワーク

  • .NET 6

作者

finphie

ライセンス

MIT

クレジット

このプロジェクトでは、次のライブラリ等を使用しています。

ライブラリ

テスト

アナライザー

その他

Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 351 3/18/2023
0.1.0 404 3/15/2022