Version

DataBindingsForTasks Property

Provides data binding support for the Tasks collection.
Syntax
'Declaration
 
Public ReadOnly Property DataBindingsForTasks As TasksDataBinding
public TasksDataBinding DataBindingsForTasks {get;}
Example
Data binding properties for Tasks.

Imports Infragistics.Win.UltraWinGanttView
Imports Infragistics.Win.UltraWinSchedule


Private Sub btnBindData_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnBindData.Click
    CreateTables() 
    DataBindCalendarInfo() 
    Me.ultraGanttView1.Project = Me.ultraCalendarInfo1.Projects.UnassignedProject 
End Sub 


Private Sub CreateTables() 
    Me.dataset = New DataSet() 
    
    'Tasks 
    Dim TaskTable As New DataTable() 
    TaskTable.TableName = "Tasks" 
    TaskTable.Columns.Add("ID", GetType(Guid)) 
    TaskTable.Columns.Add("Name") 
    TaskTable.Columns.Add("StartDateTime", GetType(DateTime)) 
    TaskTable.Columns.Add("Duration", GetType(TimeSpan)) 
    TaskTable.Columns.Add("ParentTaskID", GetType(Guid)) 

   'All properties
   'Any other Task properties not covered above are stored as
   'Binary data in the AllProperties field. This includes properties like
   'Resources, Predecessors.
    TaskTable.Columns.Add("AllProperties", GetType([Byte]())) 
    dataset.Tables.Add(TaskTable) 
    
    
    'Create Owners 
    Me.ultraCalendarInfo1.Owners.Add("Susan") 
    Me.ultraCalendarInfo1.Owners.Add("Andrew") 
    
    'Create 2 tasks 
    Dim Task1 As Task = Me.ultraCalendarInfo1.Tasks.Add(DateTime.Today, TimeSpan.FromDays(2), "Task 1")  
    Task1.Resources.Add(Me.ultraCalendarInfo1.Owners(1)) 
    
    Dim Task2 As Task = Me.ultraCalendarInfo1.Tasks.Add(DateTime.Today, TimeSpan.FromDays(3), "Task 2") 
    Task2.Resources.Add(Me.ultraCalendarInfo1.Owners(2)) 
    Task2.Dependencies.Add(Task1, TaskDependencyType.FinishToStart) 
    
    TaskTable.BeginInit() 
    
    Dim r1 As DataRow = TaskTable.NewRow() 
    'r1["ID"] = Guid.NewGuid(); 
    r1("Name") = Task1.Name 
    r1("StartDateTime") = Task1.StartDateTime 
    r1("Duration") = Task1.Duration 
    r1("AllProperties") = Task1.Save() 
    TaskTable.Rows.Add(r1) 
    
    Dim r2 As DataRow = TaskTable.NewRow() 
    r2("Name") = Task2.Name 
    r2("StartDateTime") = Task2.StartDateTime 
    r2("Duration") = Task2.Duration 
    r2("AllProperties") = Task2.Save() 
    TaskTable.Rows.Add(r2) 
    
    
    TaskTable.AcceptChanges() 
    TaskTable.EndInit() 
End Sub 

Private Sub DataBindCalendarInfo() 
    
    Me.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = Me 
    Me.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "ID" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "Name" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "StartDateTime" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "Duration" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID" 
    Me.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties" 
        
    Me.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(Me.dataset, "Tasks") 

End Sub
using Infragistics.Win.UltraWinGanttView;
using Infragistics.Win.UltraWinSchedule;

 private void btnBindData_Click(object sender, EventArgs e)
        {
            CreateTables();
            DataBindCalendarInfo();
            this.ultraGanttView1.Project = this.ultraCalendarInfo1.Projects.UnassignedProject;
        }


        private void CreateTables()
        {
            this.dataset = new DataSet();

            //Tasks
            DataTable TaskTable = new DataTable();
            TaskTable.TableName = "Tasks";
            TaskTable.Columns.Add("ID", typeof(Guid));
            TaskTable.Columns.Add("Name");
            TaskTable.Columns.Add("StartDateTime", typeof(DateTime));
            TaskTable.Columns.Add("Duration", typeof(TimeSpan));
            TaskTable.Columns.Add("ParentTaskID", typeof(Guid));

					//All properties
            // Any other Task properties not covered above are stored as
            // Binary data in the AllProperties field. This includes properties like
            // Resources, Predecessors.
             TaskTable.Columns.Add("AllProperties", typeof(Byte[]));
             dataset.Tables.Add(TaskTable);
            

            //Create Owners
            this.ultraCalendarInfo1.Owners.Add("Susan");
            this.ultraCalendarInfo1.Owners.Add("Andrew");

            //Create 2 tasks
            Task Task1 = this.ultraCalendarInfo1.Tasks.Add(DateTime.Today,TimeSpan.FromDays(2),"Task 1");
            Task1.Resources.Add(this.ultraCalendarInfo1.Owners[1]);

            Task Task2 = this.ultraCalendarInfo1.Tasks.Add(DateTime.Today,TimeSpan.FromDays(3),"Task 2");
            Task2.Resources.Add(this.ultraCalendarInfo1.Owners[2]);
            Task2.Dependencies.Add(Task1, TaskDependencyType.FinishToStart);

            TaskTable.BeginInit();

            DataRow r1 = TaskTable.NewRow();            
            //r1["ID"] = Guid.NewGuid();
            r1["Name"] = Task1.Name;
            r1["StartDateTime"] = Task1.StartDateTime;
            r1["Duration"] = Task1.Duration;
            r1["AllProperties"] = Task1.Save();
            TaskTable.Rows.Add( r1 );

            DataRow r2 = TaskTable.NewRow();
            r2["Name"] = Task2.Name;
            r2["StartDateTime"] = Task2.StartDateTime;
            r2["Duration"] = Task2.Duration;
            r2["AllProperties"] = Task2.Save();
            TaskTable.Rows.Add( r2 );


            TaskTable.AcceptChanges();
            TaskTable.EndInit();
        }

        private void DataBindCalendarInfo()
        {

            this.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = this;
            this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties";
            this.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "ID";
            this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "Name";
            this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "StartDateTime";
            this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "Duration";
            this.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID";
            this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties";
            this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(this.dataset, "Tasks");

        }
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also