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
455
System.ArgumentException "specified 'parentCollection' does not match the specified task's parent collection
posted

Hi,

I am getting an exception when I am using passing an indented task into the TaskDialog and I'm not sure why.  In the code below, I am handling the TaskDialogDisplaying event, and inferring whether the task is an exposition, a phase, or a task based on how far it's indented.  If it's not indented, it opens the TaskDialog correctly.  If it is indented at all, I get the exception.  Why are ultraGanttView.ActiveTasks & ultraGanttView.Tasks different for unindented and indented tasks? 

Thanks,

Myca

 

namespace GanttChart.ViewModel

{

    public partial class BindingGanttView : Form

    {

        #region Constructor

 

        public BindingGanttView()

        {

            InitializeComponent();

        }

 

 

        #endregion

 

        #region Private Methods

 

 

        #endregion

 

        #region Form Load Event

 

        private void BindingGanttView_Load(object sender, EventArgs e)

        {

 

            //  Set the BindingContextControl property to reference this form

            this.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = this;

            this.ultraCalendarInfo1.DataBindingsForProjects.BindingContextControl = this;

 

            // Set the DataSource and DataMember for Project and Tasks using the SetDataBinding method

            this.ultraCalendarInfo1.DataBindingsForProjects.SetDataBinding(ExpositionRepository.Instance, "ShowPlans");

            this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(ExpositionRepository.Instance, "Tasks");

 

            //  Set the DataBinding members for Projects

            this.ultraCalendarInfo1.DataBindingsForProjects.IdMember = "PlanGuid";

            this.ultraCalendarInfo1.DataBindingsForProjects.KeyMember = "PlanID";

            this.ultraCalendarInfo1.DataBindingsForProjects.NameMember = "PlanName";

            this.ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "PlanStartTime";

 

            //  Set the DataBinding members for Tasks

            // Basic Task properties

            this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName";

            this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration";

            this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime";

            this.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskGuid";

            this.ultraCalendarInfo1.DataBindingsForTasks.ProjectKeyMember = "PlanID";

            this.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskGuid"; 

            this.ultraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete";

                

            // All other properties

            this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties";

 

            //  Since we are showing a task that belongs to an explicitly defined

            //  project (i.e., not the UnassignedProject), assign that project to

            //  the control's Project property so the control knows to display that project.

            this.ultraGanttView1.CalendarInfo = new UltraCalendarInfo();

            this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects.Add("MAMdb", DateTime.Now);

 

            this.ultraGanttView1.GridAreaWidth = 400;

 

        }

 

        #endregion

 

        #region //Event Handlers

       

        public void ultraGanttView1_TaskDialogDisplaying(object sender, Infragistics.Win.UltraWinGanttView.TaskDialogDisplayingEventArgs e)

        {

            if (e.Task != null)

            {

                // The following infers whether a task is a Exposition, a phase, or a basic task based on whether it is indented under it's parent task

                if (e.Task.Parent == null) // entry is a Exposition because it has no parent task and is not indented

                    openDialogExpositionEntry();

                else if (e.Task.Parent.Parent == null) //entry is a phase because it has just one parent and no grandparents (1 indent)

                    openDialogPhaseEntry();

                else //entry is a task because it has parents and grandparents (2 indents)

                    openDialogTaskEntry();

            }

        }

        #endregion //Event Handlers

 

        #region  //Data entry forms

        private void openDialogExpositionEntry()

        {

            // There is no additional data to define Expositions, so the default Infragistics form is sufficient

            TaskDialog infragisticsDialog = new TaskDialog(ultraGanttView1.ActiveTask, ultraGanttView1.CalendarInfo.Tasks, ultraGanttView1);

            infragisticsDialog.Name = "Exposition Entry";

        }

 

        private void openDialogPhaseEntry()

        {

            TaskDialog infragisticsDialog = new TaskDialog(ultraGanttView1.ActiveTask, ultraGanttView1.CalendarInfo.Tasks, ultraGanttView1);

            UltraComboEditor phaseType = new UltraComboEditor();

            //(infragisticsDialog.Controls[0] as UltraTabControl).Tabs.["General"].TabPage.Controls.Add(phaseType);

            infragisticsDialog.Controls.Add(phaseType);

        }

 

        private void openDialogTaskEntry()

        {

            TaskDialog infragisticsDialog = new TaskDialog(ultraGanttView1.ActiveTask, ultraGanttView1.CalendarInfo.Tasks, ultraGanttView1);

 

        }

        #endregion //Data entry forms

Parents
No Data
Reply
  • 23930
    Offline posted

    Hello Myca,

    I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.

    Thank you for using Infragistics Components.

Children