public async Task<bool> ShowPopup(View view)
{
Argument.IsNotNull(() => view);
await DismissPopup();
_popupView = view;
_content.InputTransparent = true;
var backdrop = new RelativeLayout
{
BackgroundColor = Color.FromRgba(0, 0, 0, 0.4),
Opacity = 1,
GestureRecognizers =
{
new TapGestureRecognizer()
}
};
if (_popupView.BackgroundColor == Color.Default)
{
_popupView.BackgroundColor = Color.FromRgb(40, 40, 40);
}
if (_popupView.WidthRequest < 0)
{
_popupView.WidthRequest = Width;
}
if (_popupView.HeightRequest < 0)
{
_popupView.HeightRequest = Height;
}
backdrop.Children.Add(_popupView,
Constraint.RelativeToParent(p => Width/2 - _popupView.WidthRequest/2),
Constraint.RelativeToParent(p => Height/2 - _popupView.HeightRequest/2),
Constraint.RelativeToParent(p => _popupView.WidthRequest),
Constraint.RelativeToParent(p => _popupView.HeightRequest));
_backdrop = backdrop;
Children.Add(backdrop, Constraint.Constant(0), Constraint.Constant(0),
Constraint.RelativeToParent(p => p.Width), Constraint.RelativeToParent(p => p.Height));
UpdateChildrenLayout();
return await _backdrop.FadeTo(1);
}