ComponentOne OrgChart for UWP
OrgChart for UWP Quick Start / Step 2 of 3: Adding Content to the C1Org Chart Control
In This Topic
    Step 2 of 3: Adding Content to the C1Org Chart Control
    In This Topic

    In the previous step you created a Universal Windows application and added the C1OrgChart control to your project. In this step you'll add content to the C1OrgChart control.

    To customize your project and add content to the C1OrgChart control in your application, complete the following steps:

    1. In the Solution Explorer, right-click the MainPage.xaml file and select View Code. The code file will open.
    2. Add the following imports statements to the top of the page:
      Visual Basic
      Copy Code
      Imports C1.Xaml.OrgChart
      
    C#
    Copy Code
    using C1.Xaml.OrgChart;
    
    1. This code will add content to the application. Add the following code within the page constructor, directly below the InitializeComponent() method:
    Visual Basic
    Copy Code
    ' create hierarchy
    Dim uwp As New Platform() With {.Name = "UWP"}
    Dim winjs As New Platform() With {.Name = "HTML"}
    Dim xaml As New Platform() With {.Name = "XAML"}
    Dim dx As New Platform() With {.Name = "DirectX"}
    uwp.Subplatforms = New List(Of Platform)()
    uwp.Subplatforms.Add(winjs)
    uwp.Subplatforms.Add(xaml)
    uwp.Subplatforms.Add(dx)
    winjs.Subplatforms = New List(Of Platform)()
    winjs.Subplatforms.Add(New Platform() With {.Name = "JavaScript"})
    xaml.Subplatforms = New List(Of Platform)()
    xaml.Subplatforms.Add(New Platform() With {.Name = "C#"})
    xaml.Subplatforms.Add(New Platform() With {.Name = "VB"})
    dx.Subplatforms = New List(Of Platform)()
    dx.Subplatforms.Add(New Platform() With {.Name = "C++"})
    ' set to orgchart
    c1OrgChart1.Header = uwp
    

    C#
    Copy Code
    // create hierarchy
                Platform uwp = new Platform() { Name = "Windows RT" };
                Platform winjs = new Platform() { Name = "HTML" };
                Platform xaml = new Platform() { Name = "XAML" };
                Platform dx = new Platform() { Name = "DirectX" };
                uwp.Subplatforms = new List<Platform>();
                uwp.Subplatforms.Add(winjs);
                uwp.Subplatforms.Add(xaml);
                uwp.Subplatforms.Add(dx);
                winjs.Subplatforms = new List<Platform>();
                winjs.Subplatforms.Add(new Platform() { Name = "JavaScript" });
                xaml.Subplatforms = new List<Platform>();
                xaml.Subplatforms.Add(new Platform() { Name = "C#" });
                xaml.Subplatforms.Add(new Platform() { Name = "VB" });
                dx.Subplatforms = new List<Platform>();
                dx.Subplatforms.Add(new Platform() { Name = "C++" });
                // set to orgchart
                c1OrgChart1.Header = uwp;
            }
        }
    
    1.  Add the following class below the page constructor:
    Visual Basic
    Copy Code
    Public Class Platform
            Public Property Name() As String
            Public Property Subplatforms() As IList(Of Platform)
        End Class
    

    C#
    Copy Code
    public class Platform
        {
            public string Name { get; set; }
            public IList<Platform> Subplatforms { get; set; }
        }
    }
    

    In this step you added content to the C1OrgChart control. In the next step you'll run your application.

    See Also