OrgChart for WinRT
Step 2 of 3: Adding Content to the C1Org Chart Control

In the previous step you created a Windows Store 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 this.InitializeComponent() method:
Visual Basic
Copy Code
Dim winrt As Platform = New Platform
Dim winjs As Platform = New Platform
Dim xaml As Platform = New Platform
Dim dx As Platform = New Platform
winrt.Subplatforms = New List(Of Platform)
winrt.Subplatforms.Add(winjs)
winrt.Subplatforms.Add(xaml)
winrt.Subplatforms.Add(dx)
winjs.Subplatforms = New List(Of Platform)
winjs.Subplatforms.Add(New Platform)
xaml.Subplatforms = New List(Of Platform)
xaml.Subplatforms.Add(New Platform)
xaml.Subplatforms.Add(New Platform)
dx.Subplatforms = New List(Of Platform)
dx.Subplatforms.Add(New Platform)
' set to orgchart
c1OrgChart1.Header = winrt

C#
Copy Code
// create hierarchy
            Platform winrt = new Platform() { Name = "Windows RT" };
            Platform winjs = new Platform() { Name = "HTML" };
            Platform xaml = new Platform() { Name = "XAML" };
            Platform dx = new Platform() { Name = "DirectX" };
            winrt.Subplatforms = new List<Platform>();
            winrt.Subplatforms.Add(winjs);
            winrt.Subplatforms.Add(xaml);
            winrt.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 = winrt;
        }
    }
  1.  Add the following class below the page constructor:
Visual Basic
Copy Code
Public Class Platform   
    Public Property Name As String
    End Property   
    Public Property Subplatforms As IList(Of Platform)
    End Property
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

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback