Layout Customization to Ignore Certain Node Types

2 posts, 0 answers
  1. Michael
    Michael avatar
    26 posts
    Member since:
    Oct 2014

    Posted 15 Jul 2015 Link to this post


    I am trying to create "anchored flag" labels for nodes (see image) where the labels are essentially a different type of node with a single link to the primary node type.  The label nodes allow for text editing, changing fonts, colors, etc and when a user moves a primary node the corresponding label follows.  But the user can move the label independently of the node but the label will always have a link to the node.  I basically have this behavior implemented, but the issue I have involves layouts.

    When a layout is run, all nodes are considered equal and the label nodes are arranged as one would expect nodes to be arranged in the layout (using tree layouts).  But this breaks the behavior of the anchored flag label I am trying to achieve.  What I would like to do is have the layout ignore the label nodes and just affect the primary nodes.  When the primary node locations are finalized, the label nodes will follow.  The only way I can do this is to set the TreeLayoutSettings IgnoreInvisible flag to true, and when a layout is run, set all label nodes to Visibility = Collapsed, run the layout, then for all label nodes set Visibility = Visible.

    Is there a way to customize the layout so that it can ignore nodes of a certain type, (or if they have a certain property, interface, etc)?  And if that is not possible, is there a better way to handle the layout issue described above?




  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 17 Jul 2015 Link to this post

    Hello MIchael,

    This is the best well-known solution for excluding shapes from the layout - to make it invisible and after layout to make it visible again.

    Other solution which can be considered in some scenarios is to add some shapes in parent ContainerShape and use the IgrnoreContainers property set to true. This is helpful if you need to preserve some group of shapes and their relative positions when you perform global Layout.

    Petar Mladenov
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top