protected void RaiseDragEnd(RangeDragEndEventArgs args)
 {
     if (DragEnd != null)
     {
         DragEnd(this, args);
     }
 }
Exemplo n.º 2
0
        private void UpdateDraggedSource()
        {
            try
            {
                double high = HighValues[SegmentIndex], low = LowValues[SegmentIndex];
                double baseHigh = high, baseLow = low;

                DraggedValue = GetSnapToPoint(DraggedValue);
                var offset = GetSnapToPoint(DraggedValue - initialValue);
                switch (draggingMode)
                {
                case 1:
                    high = DraggedValue;
                    break;

                case 2:
                    low = DraggedValue;
                    break;

                case 3:
                    high = GetSnapToPoint(HighValues[SegmentIndex] + offset);
                    low  = GetSnapToPoint(LowValues[SegmentIndex] + offset);
                    break;
                }

                var args = new RangeDragEventArgs {
                    BaseHighValue = baseHigh, BaseLowValue = baseLow, NewHighValue = high, NewLowValue = low
                };
                RaisePreviewEnd(args);

                if (args.Cancel)
                {
                    ResetDraggingElements("", false);
                    return;
                }

                HighValues[SegmentIndex] = high;
                LowValues[SegmentIndex]  = low;

                if (UpdateSource && !IsSortData)
                {
                    UpdateUnderLayingModel(Low, SegmentIndex, LowValues[SegmentIndex]);
                    UpdateUnderLayingModel(High, SegmentIndex, HighValues[SegmentIndex]);
                }

                dragged = false;
                UpdateArea();
                var dragEvent = new RangeDragEndEventArgs {
                    BaseHighValue = baseHigh, BaseLowValue = baseLow, NewHighValue = high, NewLowValue = low
                };
                RaiseDragEnd(dragEvent);
            }
            catch
            {
                ResetDraggingElements("", false);
            }
        }