예제 #1
0
        private static void StrokeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PathControl pc = d as PathControl;

            if (pc.pathList == null || pc.pathList.Count == 0)
            {
                DependencyObject deo = pc.Content as DependencyObject;
                if (deo != null)
                {
                    pc.pathList = ControlHelper.GetChildObjects <Path>(deo);
                }
            }
            if (pc.pathList != null && pc.pathList.Count > 0)
            {
                if (e.NewValue == null)
                {
                    foreach (Path path in pc.pathList)
                    {
                        path.Stroke = pc.strokePool;
                    }
                }
                else
                {
                    foreach (Path path in pc.pathList)
                    {
                        pc.strokePool = pc.strokePool ?? path.Stroke;
                        path.Stroke   = e.NewValue as Brush;
                    }
                }
            }
        }
예제 #2
0
        private static void StrokeThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PathControl pc = d as PathControl;

            if (pc.pathList == null || pc.pathList.Count == 0)
            {
                DependencyObject deo = pc.Content as DependencyObject;
                if (deo != null)
                {
                    pc.pathList = ControlHelper.GetChildObjects <Path>(deo);
                }
            }
            if (pc.pathList != null && pc.pathList.Count > 0)
            {
                foreach (Path path in pc.pathList)
                {
                    pc.strokeThicknessPool = pc.strokeThicknessPool ?? path.StrokeThickness;
                    path.StrokeThickness   = (double)e.NewValue;
                }
            }
        }