Ejemplo n.º 1
0
        private static Style GetOverlayStyle(View popupView)
        {
            var style = DialogLayout.GetMaskStyle(popupView);

            if (style != null)
            {
                return(style);
            }

            if (Application.Current.Resources.ContainsKey(PopupOverlayStyle))
            {
                style = (Style)Application.Current.Resources[PopupOverlayStyle];
                if (style.TargetType == typeof(BoxView))
                {
                    return(style);
                }
            }

            var overlayStyle = new Style(typeof(BoxView));

            overlayStyle.Setters.Add(new Setter {
                Property = VisualElement.OpacityProperty, Value = 0.75
            });
            overlayStyle.Setters.Add(new Setter {
                Property = VisualElement.BackgroundColorProperty, Value = Color.Black
            });

            Application.Current.Resources[PopupOverlayStyle] = overlayStyle;
            return(overlayStyle);
        }