locked
How to avoid overlap of workflow activities in a rehosted designer RRS feed

  • Question

  • Hi,

    I have a rehosted workflow designer on wpf and I have a custom activity with custom activity designer containing some expander controls. When I expand the expander control, the activites below that are getting overlapped with the current desinger and gives a bad look.

    I dont find any property to make the current desinger as the top one or any other properties to overcome this issue.

    Any help on the above issue?

    Thanks.


    Yuvaraj Kesavan
    Friday, January 28, 2011 6:32 AM

Answers

  • Yuvaraj,
    Thank you for your email.

    Here is a basic illustration of how it is possible to modify the Z order of activities inside a flowchart in WF4. It relies on the specific WPF logical tree of flowchart designer, and there is some chance you would need to change it for compatibility with a future version of flowchart designer.

    Of course instead of using a button, it is probably preferable to respond to change in the designer's selection state.

     

    public partial class ZOrderDesigner : ActivityDesigner
    { 
    
     public ZOrderDesigner() 
     {
      InitializeComponent(); // there's nothing very special in the XAML for this activity, just a button which activates the Click event.
     }
    
     private void Button_Click(object sender, RoutedEventArgs e) 
     {
      var logicalParent = this.Parent; 
      if (logicalParent is DependencyObject) 
      {
       int i = (int)((logicalParent as DependencyObject).GetValue(Canvas.ZIndexProperty) ?? 0); 
       (logicalParent as DependencyObject).SetValue(Canvas.ZIndexProperty, i + 1); 
      }
     }
    }
    
    
    

    Regards,
    Tim
    • Proposed as answer by Andrew_Zhu Wednesday, February 2, 2011 11:51 AM
    • Marked as answer by Andrew_Zhu Wednesday, February 2, 2011 11:51 AM
    Tuesday, February 1, 2011 6:27 PM

All replies

  • Hi Yuvaraj,

    Is this mainly a problem which is occuring when you are looking at your activity inside of Flowchart, or are you concerned about overlapping in non-flowchart scenarios? Also, a screenshot would be helpful for understanding your problem.

    Flowchart designer, from what I remember it was designed biased towards showing activites in a collapsed format only, so I don't think it attempts to account for overlap like this, but there is a canvas there in the visual tree somewhere that might possibly respect Z-order attached properties... I can try and find out more about it - if you can confirm you are are talking about flowchart.

    Tim

    Monday, January 31, 2011 2:32 AM
  • Hi Tim,

    Thanks for your response.

    Yes, the problem is occuring for activities inside my Flowchart and am interested in Flowchart scenario.

    I cannot upload picture here. Can I send it to you via  e-mail. 


    Yuvaraj Kesavan
    Monday, January 31, 2011 5:39 AM
  • Sure, at microsoft.com. tilovell.
    Tim
    Monday, January 31, 2011 6:42 PM
  • Hi, Yuvaraj

    Could you also send this picture to me, I will help pasting here. so other people could also see it.
    email : xhinker[at]hotmail.com

    Regards


    MSDN Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    This posting is provided "AS IS" with no warranties, and confers no rights. My Blog: http://xhinker.com
    Microsoft Windows Workflow Foundation 4.0 Cookbook
    Tuesday, February 1, 2011 9:55 AM
  • Yuvaraj,
    Thank you for your email.

    Here is a basic illustration of how it is possible to modify the Z order of activities inside a flowchart in WF4. It relies on the specific WPF logical tree of flowchart designer, and there is some chance you would need to change it for compatibility with a future version of flowchart designer.

    Of course instead of using a button, it is probably preferable to respond to change in the designer's selection state.

     

    public partial class ZOrderDesigner : ActivityDesigner
    { 
    
     public ZOrderDesigner() 
     {
      InitializeComponent(); // there's nothing very special in the XAML for this activity, just a button which activates the Click event.
     }
    
     private void Button_Click(object sender, RoutedEventArgs e) 
     {
      var logicalParent = this.Parent; 
      if (logicalParent is DependencyObject) 
      {
       int i = (int)((logicalParent as DependencyObject).GetValue(Canvas.ZIndexProperty) ?? 0); 
       (logicalParent as DependencyObject).SetValue(Canvas.ZIndexProperty, i + 1); 
      }
     }
    }
    
    
    

    Regards,
    Tim
    • Proposed as answer by Andrew_Zhu Wednesday, February 2, 2011 11:51 AM
    • Marked as answer by Andrew_Zhu Wednesday, February 2, 2011 11:51 AM
    Tuesday, February 1, 2011 6:27 PM