Iciclecreek.Avalonia.WindowManager
1.0.0
See the version list below for details.
dotnet add package Iciclecreek.Avalonia.WindowManager --version 1.0.0
NuGet\Install-Package Iciclecreek.Avalonia.WindowManager -Version 1.0.0
<PackageReference Include="Iciclecreek.Avalonia.WindowManager" Version="1.0.0" />
paket add Iciclecreek.Avalonia.WindowManager --version 1.0.0
#r "nuget: Iciclecreek.Avalonia.WindowManager, 1.0.0"
// Install Iciclecreek.Avalonia.WindowManager as a Cake Addin #addin nuget:?package=Iciclecreek.Avalonia.WindowManager&version=1.0.0 // Install Iciclecreek.Avalonia.WindowManager as a Cake Tool #tool nuget:?package=Iciclecreek.Avalonia.WindowManager&version=1.0.0
Iciclecreek.Avalonia.WindowManager
This library implements a window manager for Avalonia with windows defined using Avalonia instead of native windows. This gives you the ability to create MDI style user interfaces in Avalonia, even in environments which don't support windowing like Android and iOS.
Installation
To install you need to add a reference to the nuget package Iciclecreek.Avalonia.WindowManager
dotnet add package Iciclecreek.Avalonia.WindowManager
The window manager comes with a Light and Dark theme which you need to install into your app.xaml. To do that you need to:
- Add Iciclecreek.Avalonia.WindowManager namespace
xmlns:wm="using:Iciclecreek.Avalonia.WindowManager"
- Add WindowManagerTheme
App.axaml
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wm="using:Iciclecreek.Avalonia.WindowManager"
x:Class="Demo.App"
RequestedThemeVariant="Default">
<Application.Styles>
<FluentTheme />
<wm:WindowManagerTheme/>
</Application.Styles>
</Application>
Usage
This library defines 2 classes:
- WindowManagerPanel - panel which hosts any content you want and also manages overlapping ManagedWindow instances
- ManagedWindow - a Window implementation which isn't native but instead 100% avalonia
WindowManagerPanel control
The WindowManagerPanel is a Canvas control which manages overlapping windows.
It has the following properties:
- Children - which is any children you want to have in the background of the window.
- Windows - which is enumeration of all of the windows the WindowManagerPanel owns.
And the following window oriented methods:
- ShowWindow(window) - Adds a window to the panel
- ShowAllWindows() - restores all windows
- MinimizeAllWindows() - Minimizes all windows.
ManagedWindow control
The ManagedWindow control is a clone of the Window control. It has standard Window properties like Title, WindowState, WindowStartupLocation, Position, etc. Instead of being hosted using Native windows, a ManagedWindow control is hosted by the WindowManagerPanel
Showing a window
To show a window you need to get an instance of the WindowManagerPanel and call ShowWindow().
For example:
<wm:WindowMangerPanel Name="WindowManager"/>
And code behind
var window = new ManagedWindow()
{
Title = "My window",
WindowStartupLocation=WindowStartupLocation.CenterScreen,
Width=300, Height=300
};
WindowManager.ShowWindow(window);
To close a window you simple call Close().
Showing a Dialog
To show a dialog is exactly the same as Avalonia, you instantiate a ManagedWindow and call **.ShowDialog() **passing in the parent window.
var dialogWindow = new ManagedWindow()
{
Title = "My window",
WindowStartupLocation=WindowStartupLocation.CenterScreen,
Width=300, Height=300
};
var result = await dialogWindow.ShowDialog<string>(this);
To close a dialog you call Close(result);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net9.0
- Avalonia (>= 11.2.1)
- Avalonia.Xaml.Interactions.Draggable (>= 11.2.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.