Version

Binding to Data Using Project

Topic Overview

Purpose

This topic describes how the xamGantt™ control is bound to data via Project property.

In this topic

This topic contains the following sections:

Binding xamGantt to Data Using Project

Introduction

If you want to load a data from a Microsoft Project 2010 XML file or you want to create an empty project and fill the tasks later, you may use the XamGantt Project property.

To do this, create a Project instance first and then set the xamGantt Project property to this instance.

Prerequisites

To complete the procedure, you need the following:

  • A project with the following required NuGet package reference:

    • Infragistics.WPF.Gantt

For more information on setting up the NuGet feed and adding NuGet packages, you can take a look at the following documentation: NuGet Feeds.

Preview

The following screenshot previews the result.

Binding to Data Using Project 1.png

Steps

The following steps demonstrate how to instantiate a Project and add it to the xamGantt Project property.

  1. Add required namespace(s) using/Imports in code-behind

    Add the following using/Imports namespaces in the code-behind:

    In C#:

    using Infragistics.Controls.Schedules;

    In Visual Basic:

    Imports Infragistics.Controls.Schedules
  2. Create an instance of the xamGantt

    Create a xamGantt instance in the code-behind:

    In C#:

    XamGantt gantt = new XamGantt();

    In Visual Basic:

    Dim gantt As New XamGantt()
  3. Create an instance of Project

    Create a Project instance in the code-behind:

    In C#:

    Project project = new Project();

    In Visual Basic:

    Dim project As New Project
  4. Set the xamGantt Project property to the created Project instance

    Set the xamGantt Project property to the newly created Project instance in code-behind:

    In C#:

    gantt.Project = project;

    In Visual Basic:

    gantt.Project = project
  5. Add the xamGantt control to a Grid container in a page

    Add the xamGantt control as a child of a Grid container named LayoutRoot:

    In C#:

    this.LayoutRoot.Children.Add(gantt);

    In Visual Basic:

    Me.LayoutRoot.Children.Add(gantt)

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic gives an overview of xamGantt control data binding.

This topic describes how the xamGantt control is bound to an arbitrary tasks collection via ListBackedProject.

This topic describes how an already created project plan saved in a Microsoft Project™ 2010 XML file can be loaded in the xamGantt control.