Fixed: The propagation issue of OverlayFeedbackElement.ClosedEvent.

This commit is contained in:
望尘空忧
2025-01-14 19:47:48 +08:00
parent dae550ece7
commit 93fe82c100
9 changed files with 184 additions and 63 deletions

View File

@@ -0,0 +1,42 @@
using System;
using System.IO;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Irihi.Avalonia.Shared.Contracts;
using Sandbox.ViewModels;
using Ursa.Controls;
namespace Sandbox.Views;
public partial class PW : UserControl
{
public PW()
{
InitializeComponent();
_overlayDialogHost.HostId = _hostid;
}
private string _hostid = Path.GetRandomFileName();
private async void Button_OnClick(object? sender, RoutedEventArgs e)
{
Drawer.ShowCustom(new PW(), new TestVM(), _hostid);
}
private void Close(object? sender, RoutedEventArgs e)
{
(DataContext as TestVM)?.Close();
}
}
public class TestVM : ViewModelBase, IDialogContext
{
public void Close()
{
RequestClose?.Invoke(this, 12456789);
}
public event EventHandler<object?>? RequestClose;
}