Skip to content

Commit

Permalink
Add DialogHost properties and fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteryx93 committed Mar 7, 2023
1 parent 077751a commit af7bcc1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/MvvmDialogs.Avalonia.DialogHost/DialogHostApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ internal class DialogHostApi : IDialogHostApi
host.CloseOnClickAway = settings.CloseOnClickAway;
host.CloseOnClickAwayParameter = settings.CloseOnClickAwayParameter;
host.PopupPositioner = settings.PopupPositioner;
host.OverlayBackground = settings.OverlayBackground ?? host.OverlayBackground;
host.DialogMargin = settings.DialogMargin ?? host.DialogMargin;
host.DisableOpeningAnimation = settings.DisableOpeningAnimation;
}

var closingHandler = settings.ClosingHandler ?? ((_, _) => { });
Expand Down
13 changes: 13 additions & 0 deletions src/MvvmDialogs.Avalonia.DialogHost/DialogHostSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using Avalonia.Media;
using DialogHostAvalonia;
using DialogHostAvalonia.Positioners;

Expand Down Expand Up @@ -29,4 +30,16 @@ public class DialogHostSettings : DialogSettingsBase
/// A class allowing to customize the positioning of the dialog.
/// </summary>
public IDialogPopupPositioner? PopupPositioner { get; set; }
/// <summary>
/// The background of the overlay.
/// </summary>
public IBrush? OverlayBackground { get; set; }
/// <summary>
/// The margin of the dialog view.
/// </summary>
public Thickness? DialogMargin { get; set; }
/// <summary>
/// Whether to disable the popup animation.
/// </summary>
public bool DisableOpeningAnimation { get; set; } = true;
}

0 comments on commit af7bcc1

Please sign in to comment.