Beispiel #1
0
        public static void Start(ref GrayOutDesignerExceptActiveArea grayOut, ServiceContainer services,
                                 UIElement activeContainer, Rect activeRectInActiveContainer)
        {
            Debug.Assert(services != null);
            Debug.Assert(activeContainer != null);
            DesignPanel   designPanel   = services.GetService <IDesignPanel>() as DesignPanel;
            OptionService optionService = services.GetService <OptionService>();

            if (designPanel != null && grayOut == null && optionService != null &&
                optionService.GrayOutDesignSurfaceExceptParentContainerWhenDragging)
            {
                grayOut = new GrayOutDesignerExceptActiveArea();
                grayOut.designSurfaceRectangle = new RectangleGeometry(
                    new Rect(0, 0, ((Border)designPanel.Child).Child.RenderSize.Width,
                             ((Border)designPanel.Child).Child.RenderSize.Height));
                grayOut.designPanel        = designPanel;
                grayOut.adornerPanel       = new AdornerPanel();
                grayOut.adornerPanel.Order = AdornerOrder.BehindForeground;
                grayOut.adornerPanel.SetAdornedElement(designPanel.Context.RootItem.View, null);
                grayOut.adornerPanel.Children.Add(grayOut);
                grayOut.ActiveAreaGeometry = new RectangleGeometry(activeRectInActiveContainer, 0, 0,
                                                                   (Transform)activeContainer.TransformToVisual(grayOut.adornerPanel.AdornedElement));
                Animate(grayOut.GrayOutBrush, Brush.OpacityProperty, MaxOpacity);
                designPanel.Adorners.Add(grayOut.adornerPanel);
            }
        }
Beispiel #2
0
 public static void Stop(ref GrayOutDesignerExceptActiveArea grayOut)
 {
     if (grayOut != null)
     {
         Animate(grayOut.GrayOutBrush, Brush.OpacityProperty, 0);
         IDesignPanel    designPanel          = grayOut.designPanel;
         AdornerPanel    adornerPanelToRemove = grayOut.adornerPanel;
         DispatcherTimer timer = new DispatcherTimer();
         timer.Interval = animationTime;
         timer.Tick    += delegate
         {
             timer.Stop();
             designPanel.Adorners.Remove(adornerPanelToRemove);
         };
         timer.Start();
         grayOut = null;
     }
 }
Beispiel #3
0
 public static void Start(ref GrayOutDesignerExceptActiveArea grayOut, ServiceContainer services,
                          UIElement activeContainer)
 {
     Debug.Assert(activeContainer != null);
     Start(ref grayOut, services, activeContainer, new Rect(activeContainer.RenderSize));
 }