11237 : Snap time item placements while moving

Question

I know I can use DateScaler.Snap to control time item placement, but now I want to have the time item jump in discrete steps while the user moves it.

Is that possible?

Answer

Sure, everything is possible:

    /// <summary>
    /// This is how you can quantify the movement, while moving, to, for example, 1 hour
    /// </summary>
    private void gantt1_OnTimeItem_Hoover_ForQuantifyTest(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
    {
      if (gantt1.MouseMoveKind==MouseMoveKind.move)
      {
        int orgpos=gantt1.DateScaler.TimeToPixel(e.TimeItem.Start+e.Diff);
        DateTime quantizedTime=gantt1.DateScaler.SnapTime(e.TimeItem.Start+e.Diff,new TimeSpan(1,0,0));
        int newpos=gantt1.DateScaler.TimeToPixel(quantizedTime);
        int diff=newpos-orgpos;
        e.x =e.x+diff;
      }
    }

11039 : How to get the snapped time values in the Gantt1_OnTimeItem_StopValueResize event?

Question
 
I have a gantt chart/grid where I have set the start and stopsnap times. After I change the stop time of timeitem, the cooresponding column in the grid changes to the ‘snapped’ time.  How can I get this value to use instead of the true time from the Gantt1_OnTimeItem_StopValueResize event?

Trying: e.TimeItem.GanttRow.GridNode.GetCell(3).Content.Value
gives me the original stoptime of the timeitem and : Gantt1.FocusedTimeItem.Stop.Add(e.Diff).ToString
gives me the new stoptime w/out being snapped as indicated.

Thank you for your help.

Answer
 
The snapping is calculated after the OnTimeItem_StopValueResize event, but you can use the same logic we do to calculate the snapped value: Gantt.DateScaler.SnapTime(time,precision).
 
So try this:
TimeBeforeSnap=e.TimeItem.Stop.Add(e.Diff);
TimeAfterSnap=Gantt1.DateScaler.SnapTime(TimeBeforeSnap,e.TimeItem.TimeItemLayout.SnapStopTime);