10313 : I have Start and Stop date values in the grid that I want to update when a time item changes.


I do some acutalizations of values in my grid with these event handlers, but OnTimeItem_StartValueResize and
OnTimeItem_StopValueResize are never called?

MainGantt.OnTimeItem_AfterMove        += new TimeItemEvent(MainGanttTimeItemManipulation);
MainGantt.OnTimeItem_StartValueResize += new  TimeItemEvent(MainGanttTimeItemManipulation);
MainGantt.OnTimeItem_StopValueResize  += new  TimeItemEvent(MainGanttTimeItemManipulation);

If found Entry Q10044 – FAQ: StartValueResize, but you didn’t answer the concerns that said “but for some reason it wont work” and gave a  workarround for this special case?


(Andreas sent me a sample to work with because I could not repeat this problem)

I changed the code you had in your sample to this:

        void MainGanttTimeItemManipulation(Gantt aGantt, TimeItemEventArgs e)
            if (DragStartedAtCell != null)
                GridNode TimeItemsNode = e.TimeItem.GanttRow.GridNode;
                if (MainGantt.MouseMoveKind == MouseMoveKind.resizee || MainGantt.MouseMoveKind == MouseMoveKind.move )
                    TimeItemsNode.GetCell(3).Content.Value = e.TimeItem.Stop.Add(e.Diff);
                if (MainGantt.MouseMoveKind == MouseMoveKind.resizew || MainGantt.MouseMoveKind == MouseMoveKind.move)
                    TimeItemsNode.GetCell(2).Content.Value = e.TimeItem.Start.Add(e.Diff);

So what the new code does is:

#1 check if what kind of move-op it is and decide if we need to update any or both cells (Start and Stop)
#2 If we shall update we update with the value compensated with the Difference that is about to be applied (.Add(e.Diff));


Leave a Reply