PrismNotification.WPF 2.0.5

dotnet add package PrismNotification.WPF --version 2.0.5
                    
NuGet\Install-Package PrismNotification.WPF -Version 2.0.5
                    
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="PrismNotification.WPF" Version="2.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PrismNotification.WPF" Version="2.0.5" />
                    
Directory.Packages.props
<PackageReference Include="PrismNotification.WPF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PrismNotification.WPF --version 2.0.5
                    
#r "nuget: PrismNotification.WPF, 2.0.5"
                    
#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.
#:package PrismNotification.WPF@2.0.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PrismNotification.WPF&version=2.0.5
                    
Install as a Cake Addin
#tool nuget:?package=PrismNotification.WPF&version=2.0.5
                    
Install as a Cake Tool

PrismNotification.WPF

WPF 用 Prism Library の Dialog Service をベースに、メッセージダイアログを作成しました。 動作は SampleWPFApp プロジェクトで確認できます。

事前準備

App.RegisterTypes() でメッセージダイアログを登録します。

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
    NotificationDialogService.RegisterDialog(containerRegistry);
}

メッセージダイアログを使用したい ViewModel で、 IDialogService を使えるようにします。 (Using the Dialog Service を参照)

ShowDialog 呼び出し

NotificationDialogService.ShowDialog で呼び出します。

NotificationDialogService.ShowDialog(
    _dialogService,
    "Hello world.",
    NotificationDialogButtons.YesNoCancel,
    dialogResult =>
    {
        switch (dialogResult.Result)
        {
            case ButtonResult.Yes:
                ClickResult = "Yes button clicked.";
                break;
            case ButtonResult.No:
                ClickResult = "No button clicked.";
                break;
            case ButtonResult.Cancel:
                ClickResult = "Cancel button clicked.";
                break;
            default:
                break;
        }
    });

第3引数 は NotificationDialogButtons Enum です。

NotificationDialogButtons 説明
Yes
No
Ok
Cancel
YesNo Yes ボタン、 No ボタンを表示。
OkCancel OK ボタン、 Cancel ボタンを表示。
YesNoCancel Yes ボタン、 No ボタン、 Cancel ボタンを表示。

NotificationDialogButtons.Ok にすれば、 OK ボタンのみ表示します。

多言語対応

ボタン名のデフォルト表示は英語です。 英語以外の表示できる言語は下記の通りです。

コード 言語
ja 日本語
Product Compatible and additional computed target framework versions.
.NET net9.0-windows7.0 is compatible.  net10.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
2.0.5 162 12/21/2024
2.0.4 145 12/21/2024
2.0.3 213 8/31/2024
2.0.2 179 8/31/2024
2.0.1 174 8/31/2024
2.0.0 169 8/30/2024
1.0.7 434 1/23/2023
1.0.6 373 11/27/2022
1.0.5 526 5/31/2022
1.0.4 503 5/31/2022
1.0.3 553 4/21/2022
1.0.2 542 4/16/2022
1.0.1 524 4/14/2022
1.0.0 532 4/13/2022