Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1125
Gannt view with custom list implementing IBindingList
posted

Hi 

As I understand it, the Gantt view should work with any list that implements IBindingList, assuming the list has the properties needed by the gannt view?

Is there an example anywhere that shows the ultraGanntView connected to a list of custom business objects?  I can't get it to work for me with our custom BOs.

Also, do we need to set all of the task properties in the DataBindingsForTasks (e.g. Me.UltraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName") or do some of them have defaults if not set (e.g. the ProjectKey if not using a project or the PercentCompleteMember if not showing percentages)?

Finally, is it necessary to set the values for the DataBindingsForProjects properties if you only have one project or can these be left blank?

Thanks

Parents
No Data
Reply
  • 1125
    Verified Answer
    posted

    I finally cracked this, the key seems to be that the BOs that represent tasks need to have guid id's for use as their Task Id's.

    I only needed to have properties to represent the following DataBindingsForTasks properties in our BO classes to get a basic gantt showing:

    Me.UltraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName"
    Me.UltraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration"
    Me.UltraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartDate"
    Me.UltraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskID"
    Me.UltraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID"
    Me.UltraCalendarInfo1.DataBindingsForTasks.ConstraintMember = "Constraint"

    After adding a UltraGanttView and an UltraCalendarInfo to a form, I used this code:


    ' Set the BindingContextControl property to reference this form
    Me.UltraCalendarInfo1.DataBindingsForTasks.BindingContextControl = Me

    'Set the DataBinding members for Tasks
    Me.UltraCalendarInfo1.DataBindingsForTasks.DataSource = TaskScheduledIRL.GetTaskScheduledIRL()

    ' Basic Task properties
    Me.UltraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName"
    Me.UltraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration"
    Me.UltraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartDate"
    Me.UltraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskID"
    'Me.UltraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskID"
    Me.UltraCalendarInfo1.DataBindingsForTasks.ConstraintMember = "Constraint"
    'Me.UltraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete"

    Me.UltraGanttView1.CalendarInfo = Me.UltraCalendarInfo1

    The corresponding properties in my BO classes were:

    public TimeSpan TaskDuration
    {
    get { return TimeSpan.FromDays(7); }
    }

    public int TaskPercentComplete
    {
    get { return 20; }
    }

    public Guid TaskID
    {
    get { return Guid.NewGuid(); }
    }

    public int Constraint
    {
    get { return 6; }
    }

    public DateTime TaskStartDate
    {
    get { return DateTime.Today; }
    }

    That was all it took to get it going.  The key seems to be getting the types of your BO properties right, or else it just fails silently when creating the tasks.

    Hope that helps someone else in the future.

Children
No Data