Exemplo n.º 1
0
        private static void StrokeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PathPresenter pc = d as PathPresenter;

            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;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void StrokeThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PathPresenter pc = d as PathPresenter;

            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;
                }
            }
        }