Exemplo n.º 1
0
        internal static PathElement CreatePathElement(SceneViewModel viewModel, ISceneInsertionPoint insertionPoint, ToolBehaviorContext toolContext)
        {
            PathElement pathElement = (PathElement)viewModel.CreateSceneNode(PlatformTypes.Path);

            if (insertionPoint.CanInsert((ITypeId)pathElement.Type))
            {
                insertionPoint.Insert((SceneNode)pathElement);
                using (pathElement.ViewModel.ForceBaseValue())
                {
                    toolContext.AmbientPropertyManager.ApplyAmbientProperties((SceneNode)pathElement);
                    pathElement.PathGeometry = new PathGeometry();
                    pathElement.SetValueAsWpf(ShapeElement.StretchProperty, (object)Stretch.Fill);
                }
                viewModel.ElementSelectionSet.SetSelection((SceneElement)pathElement);
                viewModel.CanonicalizeViewState(SceneUpdateTypeFlags.Completing);
            }
            return(pathElement);
        }