From 91462f6e2e955c28bba33d7c30cccce2a62490eb Mon Sep 17 00:00:00 2001 From: ema Date: Thu, 15 Aug 2024 19:16:36 +0800 Subject: [PATCH] update: README.md --- README.md | 71 +++++++++++++++++++++++++----- src/Wpf.Ui.Test/MainWindow.xaml.cs | 9 ++-- 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index be7651d..4049aed 100644 --- a/README.md +++ b/README.md @@ -6,28 +6,37 @@ [![GitHub license](https://img.shields.io/github/license/emako/wpfui.violeta)](https://github.com/emako/wpfui.violeta/blob/master/LICENSE) [![NuGet](https://img.shields.io/nuget/v/WPF-UI.Violeta.svg)](https://nuget.org/packages/WPF-UI.Violeta) [![VS 2022 Downloads](https://img.shields.io/visual-studio-marketplace/i/lepo.WPF-UI?label=vs-2022)](https://marketplace.visualstudio.com/items?itemName=lepo.WPF-UI) [![Actions](https://github.com/emako/wpfui.violeta/actions/workflows/library.nuget.yml/badge.svg)](https://github.com/emako/wpfui.violeta/actions/workflows/library.nuget.yml) [![Platform](https://img.shields.io/badge/platform-Windows-blue?logo=windowsxp&color=1E9BFA)](https://dotnet.microsoft.com/zh-cn/download/dotnet/latest/runtime) -WPF UI Violeta is based on [WPF UI](https://github.com/lepoco/wpfui), and provides the Fluent experience in your known and loved WPF framework. Some new immersive controls like `Toast`. +WPF UI Violeta is based on [WPF UI](https://github.com/lepoco/wpfui), and provides the Fluent experience in your known and loved WPF framework. Some new immersive controls like `Toast`, `Flyout`, `ContentDialog`, `MessageBox` and etc. When I decided to create this project I was listening to the song `Violeta`. ### ๐Ÿš€ Getting started -The same as WPF UI. +Similar to WPF UI. ```xaml -xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" -xmlns:vio="http://schemas.lepo.co/wpfui/2022/xaml/violeta" + + + + + + + + + + + ``` -### ๐Ÿ“ท Screenshots - -Under construction - ### ๐Ÿ‘‹Example [Wpf.Ui.Test](https://github.com/emako/wpfui.violeta/tree/master/src/Wpf.Ui.Test) -- Toast +- **Toast** + + > `Toast` is an independent popup notification that automatically disappears after a specified time. ```c# Toast.Information("I am information message"); @@ -37,7 +46,10 @@ Under construction Toast.Show(owner: null!, "I am any message", new ToastConfig()); ``` -- Flyout +- **Flyout** + + > The `FlyoutService` enables you to attach `Flyout` menus or tooltips to various controls such as `Button`, providing a flexible and intuitive way to display additional content or options. + ```xaml @@ -57,6 +69,45 @@ Under construction ``` +- **ContentDialog** + + > The `ContentDialogHostService` simplifies the creation and management of `ContentDialog` instances in your application. + + ```c# + ContentDialog dialog = + new() + { + Title = "My sample dialog", + Content = "Content of the dialog", + CloseButtonText = "Close button", + PrimaryButtonText = "Primary button", + SecondaryButtonText = "Secondary button" + }; + + // Setting the dialog container + dialog.DialogHost = ContentDialogHostService.ContentPresenterForDialogs; + + // Showing the dialog + await dialog.ShowAsync(CancellationToken.None); + ``` + +- **MessageBox** + + > To utilize Win32's classic `MessageBox` methods while supporting modern UI themes like Mica and dark mode. + + ```c# + using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox; + + MessageBox.Information("This is a information message"); + MessageBox.Warning("This is a warning message"); + MessageBox.Error("This is a error message"); + + MessageBoxResult result = MessageBox.Question("This is a question and do you want to click OK?"); + ``` + +### ๐Ÿ“ท Screenshots + +Under construction ### Thanks diff --git a/src/Wpf.Ui.Test/MainWindow.xaml.cs b/src/Wpf.Ui.Test/MainWindow.xaml.cs index d560fdc..7f9b53c 100644 --- a/src/Wpf.Ui.Test/MainWindow.xaml.cs +++ b/src/Wpf.Ui.Test/MainWindow.xaml.cs @@ -6,6 +6,7 @@ using System.Windows.Media; using Wpf.Ui.Controls; using Wpf.Ui.Violeta.Controls; +using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox; namespace Wpf.Ui.Test; @@ -95,19 +96,19 @@ private void ShowMessageBox(Button self) { if (self.Content.ToString() == "Information") { - Violeta.Controls.MessageBox.Information("This is a information message"); + MessageBox.Information("This is a information message"); } else if (self.Content.ToString() == "Warning") { - Violeta.Controls.MessageBox.Warning("This is a warning message"); + MessageBox.Warning("This is a warning message"); } else if (self.Content.ToString() == "Question") { - Violeta.Controls.MessageBox.Question("This is a question and do you want to click OK?"); + MessageBox.Question("This is a question and do you want to click OK?"); } else if (self.Content.ToString() == "Error") { - Violeta.Controls.MessageBox.Error("This is a error message"); + MessageBox.Error("This is a error message"); } } }