-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Topics to cover
It would be nice if there was an example on how to show a window or dialog from a generic view model.
public static void ShowWindow<T>(this T context, string title, uint width, uint height) where T : BaseViewModel
{
var topLevel = DialogManager.GetTopLevelForContext(context);
if (topLevel != null && !Windows.TryGetValue(typeof(T), out var window))
{
window = new Window();
window.Content = ViewLocator.Get(context);
window.Title = title;
window.Width = width;
window.Height = height;
}
window.Show();
}<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:EditorX.Avalonia.ViewModels"
xmlns::services="using:EditorX.Avalonia.Services"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="EditorX.Avalonia.Views.LayerView"
x:DataType="vm:LayerViewModel"
services:DialogManager.Register={Binding}>Ideas for a sample
- Showing window
- Hiding Window
- Toggling window
- Async Dialog
- Mvvm view model based
- Similar setup to dialog example by registering it to a user control.
Additional context
Na
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request