menu

UWP

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DirectedTreeLayout - UWP API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DirectedTreeLayout

    Represents a class to arrange the nodes and connectors automatically in a tree structure.

    Inheritance
    System.Object
    LayoutBase
    TreeLayoutBase
    DirectedTreeLayout
    Implements
    ILayout
    System.ComponentModel.INotifyPropertyChanged
    Inherited Members
    LayoutBase.Bounds
    LayoutBase.HorizontalAlignment
    LayoutBase.Margin
    LayoutBase.VerticalAlignment
    TreeLayoutBase.HorizontalSpacing
    TreeLayoutBase.PropertyChanged
    TreeLayoutBase.SpaceBetweenSubTrees
    TreeLayoutBase.VerticalSpacing
    Namespace: Syncfusion.UI.Xaml.Diagram.Layout
    Assembly: Syncfusion.SfDiagram.UWP.dll
    Syntax
    public class DirectedTreeLayout : TreeLayoutBase, ILayout, IInternalLayout, INotifyPropertyChanged
    Examples

    Below code shows how to create Hierarchical tree layout

    • Model.cs
    • MainWindow.xaml
    public class Employee
    {
        public string Name { get; set; }
        public string EmpId { get; set; }
        public string ParentId { get; set; }
        public string Designation { get; set; }
    }
    
        public class Employees : ObservableCollection<Employee>
    {
    }
    <!-- Initializes the employee collection-->
    <local:Employees x:Key="employees">
        <local:Employee Name = "Steve" EmpId="1" ParentId="" Designation="CEO"/>
        <local:Employee Name = "Kevin" EmpId="2" ParentId="1" Designation="Manager"/>
        <local:Employee Name = "John" EmpId="3" ParentId="1" Designation="Manager"/>
        <local:Employee Name = "Raj" EmpId="4" ParentId="2" Designation="Team Lead"/>
        <local:Employee Name = "Will" EmpId="5" ParentId="2" Designation="S/w Developer"/>
        <local:Employee Name = "Sarah" EmpId="6" ParentId="3" Designation="TeamLead"/>
        <local:Employee Name = "Mike" EmpId="7" ParentId="3" Designation="Testing Engineer"/>
    </local:Employees>
    
    <!--Initializes the DataSourceSettings -->
    <syncfusion:DataSourceSettings x:Key="dataSourceSettings" Id="EmpId"                               
     ParentId="ParentId" DataSource="{StaticResource employees}" />
    
    <!--Initialize the Layout-->
    <syncfusion:DirectedTreeLayout x:Name="DirectedTreeLayout"                               
                                   x:Key="treeLayout"                                
                                   HorizontalSpacing="30" 
                                   VerticalSpacing="50" 
                                   Orientation="TopToBottom" 
                                   Type="Hierarchical" 
                                   SpaceBetweenSubTrees="20" />
    
    <!--Initialize the Layout Manager-->
    <syncfusion:LayoutManager x:Key="layoutManager" 
                         Layout="{StaticResource treeLayout}"/>   
    <!--Initializes the SfDiagram-->
    <syncfusion:SfDiagram x:Name="Diagram" 
                          DataSourceSettings="{StaticResource dataSourceSettings}"
                                 LayoutManager="{Binding layoutManager}"/>

    Constructors

    DirectedTreeLayout()

    Initializes the new instance of the DirectedTreeLayout class.

    Declaration
    public DirectedTreeLayout()

    Properties

    AvoidSegmentOverlapping

    Gets or sets a value indicating whether segment of each connector from a single parent is distributed automatically or not.

    Declaration
    public bool AvoidSegmentOverlapping { get; set; }
    Property Value
    Type
    System.Boolean
    Remarks

    This property is applicable only for hierarchical and multi-parent layout.

    LayoutRoot

    Gets or sets the root node of the layout.

    Declaration
    public override object LayoutRoot { get; set; }
    Property Value
    Type
    System.Object
    Overrides
    TreeLayoutBase.LayoutRoot

    Orientation

    Gets or sets a value that indicates the dimension by which child elements are layouted in the directed tree.

    Declaration
    public TreeOrientation Orientation { get; set; }
    Property Value
    Type
    TreeOrientation

    Type

    Gets or sets the type (Organization / Hierarchical) of the layout.

    Declaration
    public LayoutType Type { get; set; }
    Property Value
    Type
    LayoutType

    Methods

    ArrangeChildren(Object, IEnumerable<INode>)

    Determine the order of Node's neighbor, during automatic layout.

    Declaration
    protected virtual IEnumerable<INode> ArrangeChildren(object parent, IEnumerable<INode> children)
    Parameters
    Type Name Description
    System.Object parent
    System.Collections.Generic.IEnumerable<INode> children
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<INode>

    Return Nodes as children for the respective parent

    GetFirstChild(INode)

    To get the first child for the parent.

    Declaration
    protected virtual INodeInfo GetFirstChild(INode parent)
    Parameters
    Type Name Description
    INode parent
    Returns
    Type Description
    INodeInfo

    Returns FirstChild of the parent.

    GetLastChild(INode)

    To get the last child for the parent.

    Declaration
    protected virtual INodeInfo GetLastChild(INode parent)
    Parameters
    Type Name Description
    INode parent
    Returns
    Type Description
    INodeInfo

    Returns the LastChild of the parent.

    GetNextSibling(INode)

    To get the next sibling of the child.

    Declaration
    protected virtual INodeInfo GetNextSibling(INode child)
    Parameters
    Type Name Description
    INode child
    Returns
    Type Description
    INodeInfo

    Returns the next sibling of the child.

    GetPreviousSibling(INode)

    To get the previous sibling of the child.

    Declaration
    protected virtual INodeInfo GetPreviousSibling(INode child)
    Parameters
    Type Name Description
    INode child
    Returns
    Type Description
    INodeInfo

    Returns the PreviousSibling of the child.

    InvalidateLayout()

    Invalidates the arrange state (layout) for the element. After the invalidation, the element will have its layout updated, which will occur asynchronously unless subsequently forced by UpdateLayout().

    Declaration
    public override void InvalidateLayout()
    Overrides
    LayoutBase.InvalidateLayout()

    OnPropertyChanged(String)

    Invokes when a property value changes.

    Declaration
    protected override void OnPropertyChanged(string name)
    Parameters
    Type Name Description
    System.String name

    The Name of the property.

    Overrides
    TreeLayoutBase.OnPropertyChanged(String)

    UpdateLayout()

    Method to update the currently arranged Nodes and Connectors.

    Declaration
    public override void UpdateLayout()
    Overrides
    LayoutBase.UpdateLayout()

    UpdateLayout(Object)

    Method to update the currently arranged Nodes and Connectors.

    Declaration
    public override void UpdateLayout(object fixedNode)
    Parameters
    Type Name Description
    System.Object fixedNode

    The node which is used as anchor to layout

    Overrides
    LayoutBase.UpdateLayout(Object)

    Implements

    ILayout
    System.ComponentModel.INotifyPropertyChanged

    Extension Methods

    DateTimeExtension.ToDateTime(Object)
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved