CommunityInteractions.Avalonia
2.0.0
dotnet add package CommunityInteractions.Avalonia --version 2.0.0
NuGet\Install-Package CommunityInteractions.Avalonia -Version 2.0.0
<PackageReference Include="CommunityInteractions.Avalonia" Version="2.0.0" />
<PackageVersion Include="CommunityInteractions.Avalonia" Version="2.0.0" />
<PackageReference Include="CommunityInteractions.Avalonia" />
paket add CommunityInteractions.Avalonia --version 2.0.0
#r "nuget: CommunityInteractions.Avalonia, 2.0.0"
#:package CommunityInteractions.Avalonia@2.0.0
#addin nuget:?package=CommunityInteractions.Avalonia&version=2.0.0
#tool nuget:?package=CommunityInteractions.Avalonia&version=2.0.0
CommunityInteractions.Avalonia
Simple package providing a streamlined way for showing dialog boxes, inspired by ReactiveUI.
Introductions
CommunityInteractions.Avalonia is a library simplifying the process of creating new windows and dialog boxes. Inspired by ReactiveUI allows for easy window creation. Compatible with any MVVM framework.
Usage
In your ViewModel create a public readonly property of type Interaction
. This will be the bridge between your ViewModel and Window.
public partial class MainWindowViewModel : ViewModelBase
{
public readonly Interaction OpenDialogInteraction = new(new DialogWindow());
}
You can also set the window later when you need it.
public partial class MainWindowViewModel : ViewModelBase
{
public readonly Interaction OpenDialogInteraction = new();
[RelayCommand]
private async Task OpenDialog()
{
OpenDialogInteraction.Window = new DialogWindow();
}
}
Next, register the owner-window from the Window class.
public partial class MainWindow : Window
{
private readonly MainWindowViewModel _vm = new();
public MainWindow()
{
InitializeComponent();
DataContext = _vm;
_vm.OpenDialogInteraction.Register(this);
}
}
Now, if you want to show your window, just call the Show()
/ShowDialog()
method. You can also retrieve the return data of a dialog by specifying its type.
// Opens window
OpenDialogInteraction.Show();
// Opens dialog
await OpenDialogInteraction.ShowDialog();
// Opens dialog and retrieves information provided by the Close method of a dialog window (Close(data))
string res = await OpenDialogInteraction.ShowDialog<string>();
Examples
Examples are provided in the CommunityInteractions.Dev project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.