protected void RaiseDragEnter(RangeSegmentEnterEventArgs args) { if (SegmentEnter != null) { SegmentEnter(this, args); } }
/// <summary> /// Updates the drag spliter low. /// </summary> /// <param name="rect">The rect.</param> protected virtual void UpdateDragSpliterLow(Rectangle rect) { int index = Segments.IndexOf(rect.Tag as ChartSegment); var args = new RangeSegmentEnterEventArgs() { XValue = GetActualXValue(index), SegmentIndex = index, CanDrag = true, HighValue = HighValues[index], LowValue = LowValues[index] }; RaiseDragEnter(args); if (!args.CanDrag) { return; } if (DragSpliterLow == null) { DragSpliterLow = new ContentControl(); SeriesPanel.Children.Add(DragSpliterLow); if (IsActualTransposed) { DragSpliterLow.Template = ChartDictionaries.GenericCommonDictionary["DragSpliterLeft"] as ControlTemplate; } else { DragSpliterLow.Template = ChartDictionaries.GenericCommonDictionary["DragSpliterTop"] as ControlTemplate; } } double canvasLeft, canvasTop, spliterHeight, spliterWidth, margin; if (IsActualTransposed) { canvasTop = Canvas.GetTop(rect); double height = rect.Height; margin = height / 3; spliterHeight = height - margin * 2; DragSpliterLow.Margin = new Thickness(0, margin, 0, margin); canvasLeft = Canvas.GetLeft(rect) + margin / 3; spliterWidth = spliterHeight / 5; } else { double bottom = Canvas.GetTop(rect) + rect.Height; double width = rect.Width; margin = width / 3; spliterWidth = width - margin * 2; DragSpliterLow.Margin = new Thickness(margin, 0, margin, 0); canvasLeft = Canvas.GetLeft(rect); canvasTop = bottom - 7; spliterHeight = spliterWidth / 5; } DragSpliterLow.SetValue(Canvas.LeftProperty, canvasLeft); DragSpliterLow.SetValue(Canvas.TopProperty, canvasTop); DragSpliterLow.Height = spliterHeight; DragSpliterLow.Width = spliterWidth; }