Exemplo n.º 1
0
        private static void TransformPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CanvasShape cs = ((CanvasShape)d);

            if (!cs.DisplayGeometry.IsFrozen)
            {
                cs.DisplayGeometry.Transform = cs.Transform;
            }
        }
Exemplo n.º 2
0
        private static object GeometryCoerceValueCallback(DependencyObject d, object baseValue)
        {
            CanvasShape cs = ((CanvasShape)d);

            if (baseValue == null)
            {
                cs.creatingNewShape = true;
                return(null);
            }
            cs.creatingNewShape = false;
            return(baseValue);
        }
Exemplo n.º 3
0
        private void CanvasShape_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (leftClickingOnShape)
            {
                CanvasShape canvasShape = (CanvasShape)sender;
                CollectionViewSource.GetDefaultView(Layers).MoveCurrentTo(canvasShape.Layer);
                CollectionViewSource.GetDefaultView(canvasShape.Layer.Shapes).MoveCurrentTo(canvasShape.DataContext);

                Deselect();
                selectedShapes.Add(canvasShape);
                PlaceThumbs(canvasShape.DisplayGeometry);
            }
            leftClickingOnShape = false;
        }
Exemplo n.º 4
0
        private static void GeometryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }
            CanvasShape cs = ((CanvasShape)d);

            if (!cs.isCommiting)
            {
                cs.geoPathGeometry = pathGeometryWriter.ToShape(e.NewValue as IGeometry) as PathGeometry;
                cs.path.Data       = cs.DisplayGeometry = cs.geoPathGeometry.Clone();
                cs.RebuildShape();
            }
        }