KavyBodarya.ToastUI 1.0.0

dotnet add package KavyBodarya.ToastUI --version 1.0.0
                    
NuGet\Install-Package KavyBodarya.ToastUI -Version 1.0.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="KavyBodarya.ToastUI" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KavyBodarya.ToastUI" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="KavyBodarya.ToastUI" />
                    
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 KavyBodarya.ToastUI --version 1.0.0
                    
#r "nuget: KavyBodarya.ToastUI, 1.0.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.
#:package KavyBodarya.ToastUI@1.0.0
                    
#: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=KavyBodarya.ToastUI&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=KavyBodarya.ToastUI&version=1.0.0
                    
Install as a Cake Tool

🍞 ToastUI - Beginner's Guide & Documentation

Welcome to ToastUI! This library allows you to easily display beautiful, non-blocking notification popups (toasts) in the bottom-right corner of your WPF applications.

Whether you need to quickly tell the user an operation was successful or require them to click a button to resolve an error, this library handles it with just one line of code.


⚙️ The Core Syntax

Whenever you want to show a popup, you will use the Show method. Here is the blueprint of how the method is structured under the hood:

ToastNotification.Show(
    Color themeColor, 
    string logoPath, 
    string text, 
    int timeoutSeconds = 0, 
    Color? textColor = null, 
    params ToastAction[] buttons
);

What do these parameters mean?

  • themeColor (Required): The main color of the popup's border and progress bar. The background automatically calculates a soft, matching pastel color. Example: Colors.MediumSeaGreen.
  • logoPath (Required): The exact file path on your computer to a small icon (like a checkmark or a warning symbol). If you don't want an icon, just pass an empty string "".
  • text (Required): The message you want the user to read.
  • timeoutSeconds (Optional): How many seconds the popup should stay on screen before sliding away.
    • Rule: If you set this to 0 (or leave it out completely), the popup will never disappear until the user clicks the "X" or a custom button.
  • textColor (Optional): The color of the text. If you don't provide one, it defaults to standard Black.
  • buttons (Optional): You can add as many clickable buttons as you want to the bottom of the toast. You do this by creating a new ToastAction("Button Name", () => YourFunction()).

💻 Code Examples

Here are three common ways to use the library in your projects. Make sure to add using ToastUI; to the very top of your C# file before trying these!

Example 1: A Temporary Success Message

Use this when something goes right, and you just want to let the user know without interrupting their work. It will disappear automatically.

// Shows a green success message that vanishes after 3 seconds.
ToastNotification.Show(
    Colors.MediumSeaGreen, 
    @"C:\Icons\check-circle.png", 
    "The new item was successfully added to the database.", 
    timeoutSeconds: 3
);

Example 2: A Persistent Error Message

Use this when something goes wrong and the user must see it. By setting the timeout to 0, the popup stays on the screen permanently until the user closes it manually.

// Shows a red error message that stays on screen forever (timeout = 0).
ToastNotification.Show(
    Colors.Firebrick, 
    @"C:\Icons\error-triangle.png", 
    "Critical Error: Could not connect to the local server. Please check your network.", 
    timeoutSeconds: 0,
    textColor: Colors.DarkRed
);

Example 3: An Interactive Warning with Buttons

This is the most powerful feature. You can add buttons directly inside the notification to let the user take immediate action.

// Shows a yellow warning with two buttons. 
// When a button is clicked, it runs the code inside the () => { ... } block and then closes the toast.
ToastNotification.Show(
    Colors.Orange, 
    @"C:\Icons\warning.png", 
    "Stock for 'Copper Wire' is running critically low (Only 4 left).", 
    timeoutSeconds: 0, 
    textColor: Colors.Black,
    new ToastAction("Order More", () => 
    {
        // Put the code here to open your ordering screen
        OpenOrderMenu("Copper Wire"); 
    }),
    new ToastAction("Dismiss", () => 
    {
        // You can leave this completely empty just to close the popup, 
        // or add code to log that the user ignored the warning.
        LogWarningIgnored();
    })
);

📝 Quick Tips for Beginners

  • No overlapping: If you trigger three popups at the exact same time, the newest one will instantly replace the older ones.
  • Images: If your image path is wrong or the file is missing, the program won't crash; the popup will simply appear without the icon.

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

    • No dependencies.

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
1.0.0 113 3/25/2026