KavyBodarya.CustomPopupLibrary
1.0.0
dotnet add package KavyBodarya.CustomPopupLibrary --version 1.0.0
NuGet\Install-Package KavyBodarya.CustomPopupLibrary -Version 1.0.0
<PackageReference Include="KavyBodarya.CustomPopupLibrary" Version="1.0.0" />
<PackageVersion Include="KavyBodarya.CustomPopupLibrary" Version="1.0.0" />
<PackageReference Include="KavyBodarya.CustomPopupLibrary" />
paket add KavyBodarya.CustomPopupLibrary --version 1.0.0
#r "nuget: KavyBodarya.CustomPopupLibrary, 1.0.0"
#:package KavyBodarya.CustomPopupLibrary@1.0.0
#addin nuget:?package=KavyBodarya.CustomPopupLibrary&version=1.0.0
#tool nuget:?package=KavyBodarya.CustomPopupLibrary&version=1.0.0
Here is a beginner-friendly version of the documentation. I have removed the heavy programming jargon (like "synchronous delegates" and "thread blocking") and replaced it with plain English, step-by-step instructions, and easy-to-read code comments.
📖 Beginner's Guide to CustomPopupLibrary
Welcome! This library is a super easy way to replace the boring, standard Windows MessageBox with a beautiful, modern, dark-themed popup.
The best part? You can add as many buttons as you want, and tell each button exactly what to do using just one line of code.
🛠️ Step 1: How to Add it to Your Project
Before you can show a popup, you need to tell your C# file where the library is.
At the very top of the C# file where you want to use the popup (like MainWindow.xaml.cs), add this line:
using CustomPopupLibrary;
🧠 Step 2: The Two Types of Popups
There are only two commands you need to know: ShowDialog and Show.
1. Popup.ShowDialog(...) (The "Stop and Wait" Popup)
Use this 90% of the time. When this popup appears, your code stops running and waits for the user to click a button.
- Best for: Asking the user a question (e.g., "Are you sure you want to delete this?").
2. Popup.Show(...) (The "Keep Going" Popup)
When this popup appears, your code keeps running in the background. The user can even click on your main app while the popup is still open.
- Best for: Showing a friendly notification (e.g., "Files are downloading in the background...").
🔘 Step 3: How to Make Buttons
Making buttons in this library uses a cool C# trick. You group the Name of the button and the Code it should run inside parentheses ( ), separated by a comma.
It looks like this:
("Button Name", () => { /* Your code goes here */ })
"Button Name": This is the text the user will see.() => { }: This is a shortcut way in C# to say "Run this action." If you leave the brackets empty, the button will just close the popup and do nothing else.
💻 Step 4: Copy & Paste Examples
Here are the most common ways you will use the popup. Copy and paste these directly into your button click events!
Example 1: A Simple "OK" Message
This is just a friendly alert. It has no image, and one button that just closes the window.
Popup.ShowDialog(
"Saved Successfully", // 1. The Title
null, // 2. The Image (null means no image)
"Your profile has been updated.", // 3. The Message
("Awesome!", () => { }) // 4. The Button (Empty brackets = just close)
);
Example 2: Asking a "Yes / No" Question
This asks the user a question and runs different code depending on what they click.
Popup.ShowDialog(
"Warning",
null,
"Are you sure you want to delete this file?",
// Button 1: Runs your delete code
("Yes, Delete it", () =>
{
// Put your delete code here!
MessageBox.Show("File deleted.");
}),
// Button 2: Does nothing, just closes the popup
("Cancel", () => { })
);
Example 3: Showing a Picture/Icon in the Popup
If you want to show a warning sign or a logo, replace the null with the path to your image.
// Path to an image on your computer
string imageLocation = @"C:\Users\YourName\Pictures\warning_icon.png";
Popup.ShowDialog(
"Uh Oh!",
imageLocation, // <--- Put the image variable here
"Something went wrong. Do you want to try again?",
("Retry", () => { /* Retry code here */ }),
("Close", () => { })
);
💡 Good Things to Know!
- It Auto-Closes: Whenever the user clicks any button you created, the popup will automatically run your code and then close itself. You don't have to write code to close it!
- Move it around: Because there is no top bar, you can click and hold anywhere on the popup's dark background to drag it around your screen.
- Unlimited Buttons: You can add as many buttons as you want. Just keep adding them to the end of the list separated by commas!
How does this look? Would you like me to guide you on how to turn this whole project into a NuGet package next, so you can install it into any future project with just one click?
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
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 | 148 | 3/24/2026 |