-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #542 from WCKYWCKF/pr2
Fixed: Other windows closing due to error in handling the Drawer close event.
- Loading branch information
Showing
12 changed files
with
250 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<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:u="https://irihi.tech/ursa" | ||
MinHeight="200" | ||
MinWidth="500" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="Sandbox.Views.PW"> | ||
<Panel> | ||
<Button Content="???" Click="Button_OnClick"></Button> | ||
<Button Content="close" VerticalAlignment="Bottom" Click="Close"></Button> | ||
<u:OverlayDialogHost x:Name="_overlayDialogHost" ></u:OverlayDialogHost> | ||
</Panel> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.