Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emako/wpfui.violeta
WPF UI Violeta is based on WPF UI, and provides the Fluent experience in your known and loved WPF framework.
https://github.com/emako/wpfui.violeta
csharp dotnet fluent mica theme ui windows-10 windows-11 wpf wpf-controls wpf-ui xaml
Last synced: 9 days ago
JSON representation
WPF UI Violeta is based on WPF UI, and provides the Fluent experience in your known and loved WPF framework.
- Host: GitHub
- URL: https://github.com/emako/wpfui.violeta
- Owner: emako
- License: mit
- Created: 2024-08-13T10:02:56.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-10-26T19:32:10.000Z (10 days ago)
- Last Synced: 2024-10-26T21:40:06.496Z (10 days ago)
- Topics: csharp, dotnet, fluent, mica, theme, ui, windows-10, windows-11, wpf, wpf-controls, wpf-ui, xaml
- Language: C#
- Homepage:
- Size: 3.34 MB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![WPF UI Banner Dark](https://user-images.githubusercontent.com/13592821/174165081-9c62d188-ecb6-4200-abd8-419afbaf32c2.png#gh-dark-mode-only)
![WPF UI Banner Light](https://user-images.githubusercontent.com/13592821/174165388-921c4745-90ed-4396-9a4b-9c86478f7447.png#gh-light-mode-only)
# WPF UI Violeta
[![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`, `Flyout`, `ContentDialog`, `MessageBox` and etc.
Some idea or codes are ported from [ModernWpf](https://github.com/Kinnara/ModernWpf) and [Fischless](https://github.com/GenshinMatrix/Fischless).
When I decided to create this project I was listening to the song `Violeta`.
### π Getting started
Similar to WPF UI.
```xaml
```
### πExamples
[Wpf.Ui.Test](https://github.com/emako/wpfui.violeta/tree/master/src/Wpf.Ui.Test)
- **Toast**
> `Toast` is an independent popup notification that automatically disappears after a specified time.
```c#
Toast.Information("I am information message");
Toast.Error("I am error message");
Toast.Success("I am success message");
Toast.Warning("I am warning message");
Toast.Show(owner: null!, "I am any message", new ToastConfig());
```- **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
```
- **ContentDialogHostService**> The `ContentDialogHostService` simplifies the creation and management of `ContentDialog` instances in your application.
```c#
Wpf.Ui.Controls.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);
```
- **ContentDialog**> The new `ContentDialog` is easy to use with smooth transitions.
```c#
global using ContentDialog = Wpf.Ui.Violeta.Controls.ContentDialog;
global using ContentDialogButton = Wpf.Ui.Violeta.Controls.ContentDialogButton;
ContentDialog dialog = new()
{
Title = "My sample dialog",
Content = "Content of the dialog",
CloseButtonText = "Close button",
PrimaryButtonText = "Primary button",
SecondaryButtonText = "Secondary button",
DefaultButton = ContentDialogButton.Primary,
};
_ = await dialog.ShowAsync();
```
- **MessageBox**> To utilize Win32's classic `MessageBox` methods while supporting modern UI themes like Mica and dark mode.
```c#
global using MessageBox = Wpf.Ui.Violeta.Controls.MessageBox;
// Sync methods
_ = 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?");
// Async methods
_ = await MessageBox.InformationAsync("This is a information message");
_ = await MessageBox.WarningAsync("This is a warning message");
_ = await MessageBox.ErrorAsync("This is a error message");
MessageBoxResult result = await MessageBox.QuestionAsync("This is a question and do you want to click OK?");
```- **ToggleButtonGroup** / **RadioButtonGroup** / **MenuItemGroup**
> Turn the ToggleButton and RadioButton under the same Group into a radio button.
```xaml
```
```xaml
```
- **Splash**> Show the Splash Screen in another UI thread.
```c#
public App()
{
Splash.ShowAsync("pack://application:,,,/Wpf.Ui.Test;component/wpfui.png");
InitializeComponent();
}
public MainWindow()
{
InitializeComponent();
Splash.CloseOnLoaded(this, minimumMilliseconds: 1800);
}
```- **TreeListView**
> TreeListView is a better way to display hierarchical data.
```xaml
``````c#
public partial class ViewModel : ObservableObject
{
[ObservableProperty]
private ObservableCollection staffList = [];
public void InitNode1Value()
{
Staff staff = new Staff()
{
Name = "Alice",
Age = 30,
Sex = "Male",
Duty = "Manager",
IsExpanded = true
};
Staff staff2 = new Staff()
{
Name = "Alice1",
Age = 21,
Sex = "Male",
Duty = "Normal",
IsExpanded = true
};
Staff staff3 = new Staff()
{
Name = "Alice11",
Age = 21,
Sex = "Male",
Duty = "Normal"
};
staff2.StaffList.Add(staff3);
staff3 = new Staff()
{
Name = "Alice22",
Age = 21,
Sex = "Female",
Duty = "Normal"
};
staff2.StaffList.Add(staff3);
staff.StaffList.Add(staff2);
staff2 = new Staff()
{
Name = "Alice2",
Age = 22,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
staff2 = new Staff()
{
Name = "Alice3",
Age = 23,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
StaffList.Add(staff);
staff = new Staff()
{
Name = "Bob",
Age = 31,
Sex = "Male",
Duty = "CEO"
};
staff2 = new Staff()
{
Name = "Bob1",
Age = 24,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
staff2 = new Staff()
{
Name = "Bob2",
Age = 25,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
staff2 = new Staff()
{
Name = "Bob3",
Age = 26,
Sex = "Male",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
StaffList.Add(staff);
staff = new Staff()
{
Name = "Cyber",
Age = 32,
Sex = "Female",
Duty = "Leader"
};
staff2 = new Staff()
{
Name = "Cyber1",
Age = 27,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
staff2 = new Staff()
{
Name = "Cyber2",
Age = 28,
Sex = "Female",
Duty = "Normal"
};
staff.StaffList.Add(staff2);
StaffList.Add(staff);
}
}
public partial class Staff : ObservableObject
{
[ObservableProperty]
private string name = null!;
[ObservableProperty]
private int age;
[ObservableProperty]
private string sex = null!;
[ObservableProperty]
private string duty = null!;
[ObservableProperty]
private bool isChecked = true;
[ObservableProperty]
private bool isSelected = false;
[ObservableProperty]
private bool isExpanded = false;
[ObservableProperty]
private ObservableCollection staffList = [];
}
```
- **TreeModelListView**> TreeModelListView is a fast tree list view used `IEnumerable` and `ITreeModel` to display data but CURD is not fully supported.
```xaml
``````c#
public partial class ViewModel : ObservableObject
{
[ObservableProperty]
private TreeCollection treeTestModel = CreateTestModel();
public static TreeModelCollection CreateTestModel()
{
return new TreeModelCollection()
{
Children = new(
[
new()
{
Column1 = "Test 1",
Column2 = "Test 1",
Column3 = "Test 1",
Children = new(
[
new()
{
Column1 = "Test 1.1",
Column2 = "Test 1.1",
Column3 = "Test 1.1",
Children = new(
[
new()
{
Column1 = "Test 1.2",
Column2 = "Test 1.2",
Column3 = "Test 1.2",
},
]),
},
]),
},
new()
{
Column1 = "Test 2",
Column2 = "Test 2",
Column3 = "Test 2",
}
]),
};
}
}
[ObservableObject]
public partial class TreeTestModel : TreeModelObject
{
[ObservableProperty]
private string? column1;
[ObservableProperty]
private string? column2;
[ObservableProperty]
private string? column3;
[ObservableProperty]
private bool isChecked = false;
}
```- **ImageView**
> Provides a scalable image control.
```xaml
```- **ExceptionReport**
> Show a dialog to handle the `DispatcherUnhandledException` from Application.
```c#
public partial class App : Application
{
public App()
{
InitializeComponent();
DispatcherUnhandledException += (object s, DispatcherUnhandledExceptionEventArgs e) =>
{
e.Handled = true;
ExceptionReport.Show(e.Exception);
};
}
}
```- **BitmapIcon**
> Supports to show monochrome image that match the theme color.
```xaml
```### π· Screenshots
Under construction
### Thanks
- [π WPF-UI](https://github.com/lepoco/wpfui)
- [π Fischless](https://github.com/GenshinMatrix/Fischless)
- [π ModernWpf](https://github.com/Kinnara/ModernWpf)
- [π TreeListView](https://www.codeproject.com/Articles/30721/WPF-TreeListView-Control)
- [πCachedImage](https://github.com/floydpink/CachedImage)