예제 #1
0
        void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
        {
            this.guideItem = (DataContext as GuideLineDecorator).DataContext as GuideItemBase;

            //Set selection property
            containerCanvas = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(DataContext as GuideLineDecorator)) as Canvas;
            GuideBoxViewModel LineContianer = containerCanvas.DataContext as GuideBoxViewModel;

            scale = LineContianer.Scale;
            foreach (GuideItemBase item in LineContianer.GuideItems)
            {
                item.IsSelected = false;
            }
            guideItem.IsSelected = true;


            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);

            if (adornerLayer != null)
            {
                if (this.guideItem is HorizontalGuideLine)
                {
                    this.adorner = new MousePositionAdorner(this, false);
                    InfoGuide    = string.Format("y: {0}", Convert.ToInt16((this.guideItem as HorizontalGuideLine).ActualTop));
                    oldPos       = guideItem.Guide.Y;
                }
                else
                {
                    this.adorner = new MousePositionAdorner(this, true);
                    InfoGuide    = string.Format("x: {0}", Convert.ToInt16((this.guideItem as VerticalGuideLine).ActualLeft));
                    oldPos       = guideItem.Guide.X;
                }
                adornerLayer.Add(this.adorner);
            }
        }
예제 #2
0
 protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
 {
     base.OnMouseRightButtonDown(e);
     this.guideItem = (DataContext as GuideLineDecorator).DataContext as GuideItemBase;
     if (guideItem != null)
     {
         this.guideItem.UpdateGridGuide();
     }
     e.Handled = true;
 }