feat: refactor dialog host to accept drawer.

This commit is contained in:
rabbitism
2024-02-04 17:13:01 +08:00
parent ff8d4b1dcd
commit dbbf6b62b6
14 changed files with 435 additions and 409 deletions

View File

@@ -1,6 +1,29 @@
using Avalonia.Controls.Primitives;
namespace Ursa.Controls;
public class CustomDrawerControl: DrawerControlBase
{
internal bool IsCloseButtonVisible { get; set; }
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
if (_closeButton is not null)
{
_closeButton.IsVisible = IsCloseButtonVisible;
}
}
public override void Close()
{
if (DataContext is IDialogContext context)
{
context.Close();
}
else
{
OnElementClosing(this, null);
}
}
}