locked
Z-Order of Activities RRS feed

  • Question

  • Hi,

    I know that expand/collapse is not currently supported for flowcharts, but we needed to implement similar behavior in which a custom designer can temporarily expand to show more content (understanding that there will be overlap of other items).

    The issue that we are having is that we want our content to be displayed on top of other Activities/Connectors.  It renders on top if our Activity is added to the designer later than any activities being overlapped.  However, if the other activity is added to the designer later, then it renders on top of our activity.  Thus, it appears that the z-order is based on the order in which the activites are added to the designer. 

    Is there a way to allow our activity to be displayed with a higher z-order/on top of other activities and connections?

    Thank you.

     

    Monday, May 17, 2010 6:38 PM

Answers

  • Sorry, I don't think we explicitly support Z-order in the flowchart designer. But there may be a workaround. If you can bring your activity onto the top once you click it, will that work for you? If that works for you, please consider the following workaround.

    class YourActivityDesigner

    {

         protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
         {
                this.BringToFront();
                base.OnPreviewGotKeyboardFocus(e);
         }

         void BringToFront()
          {

               DependencyObject current = this;
               do
               {
                    current = VisualTreeHelper.GetParent(current);
               }
               while (current!= null && !typeof(Panel).IsAssignableFrom(current.GetType()));

               Panel panel = current as Panel;          
               if (panel != null)
               {
                   panel.Children.Remove(this);
                   panel.Children.Add(this);

               }

          }

    }

     

    • Proposed as answer by Cecilia.Leung Tuesday, May 18, 2010 3:55 AM
    • Marked as answer by _Antikythera_ Tuesday, May 18, 2010 10:09 PM
    Tuesday, May 18, 2010 3:39 AM
  • >It looks like there is a parent "VirtualizingContainer" of the activity.  Thus, the activity is not an immediate child of the panel and hence, is not removed.

    That's correct. Removing/adding the virtualizing container instead might work.

    Tim

    • Marked as answer by _Antikythera_ Tuesday, May 18, 2010 10:07 PM
    Tuesday, May 18, 2010 7:41 PM

All replies

  • Hi Antiky,

    Are you reusing FlowchartDesigner or have you implemented your own custom designer?

    Tim

    Monday, May 17, 2010 9:35 PM
  • Hi Tim,

    We are not re-using FlowchartDesigner - we are just creating a WorkflowDesigner.

    Thank you.

    Monday, May 17, 2010 10:14 PM
  • Hi Tim,

    Sorry, I was incorrect, we actually are re-using the FlowchartDesigner (Flowchart is the root activity).

    Thank you.

    Monday, May 17, 2010 11:08 PM
  • Sorry, I don't think we explicitly support Z-order in the flowchart designer. But there may be a workaround. If you can bring your activity onto the top once you click it, will that work for you? If that works for you, please consider the following workaround.

    class YourActivityDesigner

    {

         protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
         {
                this.BringToFront();
                base.OnPreviewGotKeyboardFocus(e);
         }

         void BringToFront()
          {

               DependencyObject current = this;
               do
               {
                    current = VisualTreeHelper.GetParent(current);
               }
               while (current!= null && !typeof(Panel).IsAssignableFrom(current.GetType()));

               Panel panel = current as Panel;          
               if (panel != null)
               {
                   panel.Children.Remove(this);
                   panel.Children.Add(this);

               }

          }

    }

     

    • Proposed as answer by Cecilia.Leung Tuesday, May 18, 2010 3:55 AM
    • Marked as answer by _Antikythera_ Tuesday, May 18, 2010 10:09 PM
    Tuesday, May 18, 2010 3:39 AM
  • Hi Kenny,

    Bringing our activity to the front when it is clicked should be sufficient.

    I tried the workaround but I am getting an InvalidOperationException (Specified element is already the logical child of another element. Disconnect it first.) on the line "panel.Children.Add(this);"  It looks like there is a parent "VirtualizingContainer" of the activity.  Thus, the activity is not an immediate child of the panel and hence, is not removed.

    Thank you.

     

    Tuesday, May 18, 2010 4:52 PM
  • >It looks like there is a parent "VirtualizingContainer" of the activity.  Thus, the activity is not an immediate child of the panel and hence, is not removed.

    That's correct. Removing/adding the virtualizing container instead might work.

    Tim

    • Marked as answer by _Antikythera_ Tuesday, May 18, 2010 10:07 PM
    Tuesday, May 18, 2010 7:41 PM
  • Tim,

    After removing and re-adding the VirtualizingContainer, everything appears to be working great.

    Thanks for your help.

     

    Tuesday, May 18, 2010 10:07 PM