Fixed: The propagation issue of OverlayFeedbackElement.ClosedEvent.
This commit is contained in:
42
demo/Sandbox/Views/PW.axaml.cs
Normal file
42
demo/Sandbox/Views/PW.axaml.cs
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user