feat: WIP
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
Theme="{DynamicResource CardBorder}">
|
Theme="{DynamicResource CardBorder}">
|
||||||
<Grid RowDefinitions="Auto, *, Auto">
|
<Grid RowDefinitions="Auto, *, Auto">
|
||||||
<StackPanel Grid.Row="0" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="0" HorizontalAlignment="Right">
|
||||||
<Button Name="{x:Static u:DialogControl.PART_CloseButton}">Close</Button>
|
<Button Name="{x:Static u:DialogControl.PART_CloseButton}" >Close</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
|
<Panel Margin="{TemplateBinding WindowDecorationMargin}" Background="Transparent" />
|
||||||
<ChromeOverlayLayer />
|
<ChromeOverlayLayer />
|
||||||
<Grid RowDefinitions="Auto, *, Auto">
|
<Grid RowDefinitions="Auto, *, Auto">
|
||||||
<Button Name="{x:Static u:DialogWindow.PART_CloseButton}" VerticalAlignment="Top">Close</Button>
|
<Button Name="{x:Static u:DialogWindow.PART_CloseButton}" VerticalAlignment="Top" HorizontalAlignment="Right">Close</Button>
|
||||||
<ContentPresenter Content="{TemplateBinding Content}" />
|
<ContentPresenter Grid.Row="0" Grid.RowSpan="2" Content="{TemplateBinding Content}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Panel>
|
</Panel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls.Metadata;
|
using Avalonia.Controls.Metadata;
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
|
|
||||||
namespace Ursa.Controls;
|
namespace Ursa.Controls;
|
||||||
@@ -59,4 +60,9 @@ public class DialogWindow: Window
|
|||||||
Close(null);
|
Close(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
this.BeginMoveDrag(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Controls.Shapes;
|
using Avalonia.Controls.Shapes;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Layout;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Utilities;
|
using Avalonia.Utilities;
|
||||||
using Avalonia.VisualTree;
|
using Avalonia.VisualTree;
|
||||||
@@ -36,6 +37,24 @@ public class OverlayDialogHost: Canvas
|
|||||||
{
|
{
|
||||||
base.OnAttachedToVisualTree(e);
|
base.OnAttachedToVisualTree(e);
|
||||||
OverlayDialogManager.RegisterOverlayDialogHost(this, HostId);
|
OverlayDialogManager.RegisterOverlayDialogHost(this, HostId);
|
||||||
|
this.Children.Add(new Border()
|
||||||
|
{
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Stretch,
|
||||||
|
VerticalAlignment = VerticalAlignment.Stretch,
|
||||||
|
Background = Brushes.Black,
|
||||||
|
Opacity = 0.3,
|
||||||
|
IsVisible = false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSizeChanged(SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnSizeChanged(e);
|
||||||
|
if (this.Children.Count > 0)
|
||||||
|
{
|
||||||
|
this.Children[0].Width = this.Bounds.Width;
|
||||||
|
this.Children[0].Height = this.Bounds.Height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
@@ -85,6 +104,10 @@ public class OverlayDialogHost: Canvas
|
|||||||
{
|
{
|
||||||
this.Children.Add(control);
|
this.Children.Add(control);
|
||||||
control.OnClose += OnDialogClose;
|
control.OnClose += OnDialogClose;
|
||||||
|
if (this.Children.Count > 1)
|
||||||
|
{
|
||||||
|
this.Children[0].IsVisible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDialogClose(object sender, object? e)
|
private void OnDialogClose(object sender, object? e)
|
||||||
@@ -93,6 +116,10 @@ public class OverlayDialogHost: Canvas
|
|||||||
{
|
{
|
||||||
this.Children.Remove(control);
|
this.Children.Remove(control);
|
||||||
control.OnClose -= OnDialogClose;
|
control.OnClose -= OnDialogClose;
|
||||||
|
if (this.Children.Count == 1)
|
||||||
|
{
|
||||||
|
this.Children[0].IsVisible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user