feat: make sure MessageBox support drag move.

This commit is contained in:
rabbitism
2024-03-10 16:12:32 +08:00
committed by rabbitism
parent 6e897b63fe
commit 0349f6ad95
3 changed files with 4 additions and 4 deletions

View File

@@ -150,6 +150,7 @@
<ControlTheme x:Key="{x:Type u:MessageBoxControl}" TargetType="u:MessageBoxControl">
<Setter Property="CornerRadius" Value="12" />
<Setter Property="Padding" Value="48 24" />
<Setter Property="u:DialogControlBase.CanDragMove" Value="True"></Setter>
<Setter Property="Template">
<ControlTemplate TargetType="u:MessageBoxControl">
<Border

View File

@@ -30,7 +30,6 @@ public abstract class DialogControlBase : OverlayFeedbackElement
internal double? HorizontalOffsetRatio { get; set; }
internal double? VerticalOffsetRatio { get; set; }
internal bool CanLightDismiss { get; set; }
internal bool CanDragMove { get; set; }
protected internal Button? _closeButton;
private Panel? _titleArea;
@@ -143,7 +142,7 @@ public abstract class DialogControlBase : OverlayFeedbackElement
{
base.OnApplyTemplate(e);
_titleArea = e.NameScope.Find<Panel>(PART_TitleArea);
if (CanDragMove)
if (GetCanDragMove(this))
{
_titleArea?.RemoveHandler(PointerMovedEvent, OnTitlePointerMove);
_titleArea?.RemoveHandler(PointerPressedEvent, OnTitlePointerPressed);

View File

@@ -191,7 +191,7 @@ public static class OverlayDialog
options.VerticalAnchor == VerticalPosition.Center ? null : options.VerticalOffset;
control.IsCloseButtonVisible = options.ShowCloseButton;
control.CanLightDismiss = options.CanLightDismiss;
control.CanDragMove = options.CanDragMove;
DialogControlBase.SetCanDragMove(control, options.CanDragMove);
}
private static void ConfigureDefaultDialogControl(DefaultDialogControl control, OverlayDialogOptions? options)
@@ -209,7 +209,7 @@ public static class OverlayDialog
control.Buttons = options.Buttons;
control.Title = options.Title;
control.CanLightDismiss = options.CanLightDismiss;
control.CanDragMove = options.CanDragMove;
DialogControlBase.SetCanDragMove(control, options.CanDragMove);
}
internal static T? Recall<T>(string? hostId) where T: Control