Skip to content

Commit

Permalink
add ability to provide custom mask (i.e. gradient layer)
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jun 6, 2019
1 parent 1a49f73 commit 24e54a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Source/Xamarin/Prism.Forms/Services/Dialogs/DialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,18 @@ private ContentPage GetCurrentPage(Page page = null)

private void InsertPopupViewInCurrentPage(ContentPage currentPage, View popupView, bool hideOnBackgroundTapped, Action<IDialogParameters> callback)
{
Style overlayStyle = GetOverlayStyle(popupView);
View mask = DialogLayout.GetMask(popupView);

var mask = new BoxView
if(mask is null)
{
Style = overlayStyle
};
Style overlayStyle = GetOverlayStyle(popupView);

mask = new BoxView
{
Style = overlayStyle
};
}

mask.SetBinding(VisualElement.WidthRequestProperty, new Binding { Path = "Width", Source = currentPage });
mask.SetBinding(VisualElement.HeightRequestProperty, new Binding { Path = "Height", Source = currentPage });

Expand Down
10 changes: 10 additions & 0 deletions Source/Xamarin/Prism.Forms/Services/Dialogs/Xaml/DialogLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,15 @@ public static Style GetMaskStyle(BindableObject bindable) =>

public static void SetMaskStyle(BindableObject bindable, Style value) =>
bindable.SetValue(MaskStyleProperty, value);

public static readonly BindableProperty MaskProperty =
BindableProperty.CreateAttached("Mask", typeof(View), typeof(DialogLayout), null);

public static View GetMask(BindableObject bindable) =>
(View)bindable.GetValue(MaskProperty);

public static void SetMask(BindableObject bindable, View value) =>
bindable.SetValue(MaskProperty, value);

}
}

0 comments on commit 24e54a1

Please sign in to comment.