feat: WIP dialog window.

This commit is contained in:
rabbitism
2024-01-21 23:40:06 +08:00
parent a0598b6a47
commit 2c361f9f3c
9 changed files with 193 additions and 19 deletions

View File

@@ -0,0 +1,30 @@
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
namespace Ursa.Controls;
[TemplatePart(PART_CloseButton, typeof(Button))]
public class DialogWindow: Window
{
public const string PART_CloseButton = "PART_CloseButton";
protected override Type StyleKeyOverride { get; } = typeof(DialogWindow);
private Button? _closeButton;
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
_closeButton = e.NameScope.Find<Button>(PART_CloseButton);
if (_closeButton != null)
{
_closeButton.Click += (sender, args) =>
{
Close();
};
}
}
}