internal void RemoveModal(UIElement closingElement, bool hideBlurrer) { if (_panel.Children.Count > 1) { var decorator = PeekChild() as Decorator; if (decorator != null) { UIElement element = decorator.Child; if (ReferenceEquals(element, closingElement)) { _panel.Children.Remove(decorator); int childCount = _panel.Children.Count; if (childCount > 0) { UIElement child = PeekChild(); child.IsHitTestVisible = true; if (childCount <= 2 && hideBlurrer) { AnimatorService.AnimatePropertyFromTo(_blurrer, OpacityProperty, null, 0, BlurrerAnimationDurationMs, HideBlurrer); } } UpdateModalCount(); } } } }
internal void AddModal(UIElement newElement, bool showBlurrer) { int childCount = _panel.Children.Count; if (childCount > 1) { UIElement child = PeekChild(); child.IsHitTestVisible = false; } if (childCount <= 2 && showBlurrer) { _blurrer.InvalidateArrange(); AnimatorService.AnimatePropertyFromTo(_blurrer, OpacityProperty, 0, null, BlurrerAnimationDurationMs); _blurrer.Visibility = Visibility.Visible; } _panel.Children.Add(CreateDecorator(newElement)); UpdateModalCount(); }