protected void BindToThis(DirectPath target, bool includeFill, bool includeDotDash)
        {
            // Set Stroke property to apply to both the Line and Markers
            Binding strokeBinding = new Binding("Stroke")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            target.SetBinding(DirectPath.StrokeProperty, strokeBinding);
            // Set StrokeThickness property also to apply to both the Line and Markers
            Binding strokeThicknessBinding = new Binding("StrokeThickness")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            target.SetBinding(DirectPath.StrokeThicknessProperty, strokeThicknessBinding);
            // Fill binding
            Binding fillBinding = new Binding("MarkersFill")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            if (includeFill)
            {
                target.SetBinding(DirectPath.FillProperty, fillBinding);
            }
            // Dot-dash of line
            if (includeDotDash)
            {
                Binding dashBinding = new Binding("QuickStrokeDash")
                {
                    Source = this, Mode = BindingMode.OneWay
                };
                target.SetBinding(DirectPath.QuickStrokeDashProperty, dashBinding);
            }
        }
 public void RemovePath(DirectPath path)
 {
     (directImage as Direct2DImage).paths.Remove(path);
     path.Dispose();
 }
 public void AddPath(DirectPath path)
 {
     (directImage as Direct2DImage).paths.Add(path);
     path.DirectImage = directImage;
     path.RecreateDisposables();
 }
 public void RemovePath(DirectPath path)
 {
     (directImage as Direct2DImage).paths.Remove(path);
     path.Dispose();
 }
 public void AddPath(DirectPath path)
 {
     (directImage as Direct2DImage).paths.Add(path);
     path.DirectImage = directImage;
     path.RecreateDisposables();
 }
Exemple #6
0
 protected void BindToThis(DirectPath target, bool includeFill, bool includeDotDash)
 {
     // Set Stroke property to apply to both the Line and Markers
     Binding strokeBinding = new Binding("Stroke") { Source = this, Mode = BindingMode.OneWay };
     target.SetBinding(DirectPath.StrokeProperty, strokeBinding);
     // Set StrokeThickness property also to apply to both the Line and Markers
     Binding strokeThicknessBinding = new Binding("StrokeThickness") { Source = this, Mode = BindingMode.OneWay };
     target.SetBinding(DirectPath.StrokeThicknessProperty, strokeThicknessBinding);
     // Fill binding
     Binding fillBinding = new Binding("MarkersFill") { Source = this, Mode = BindingMode.OneWay };
     if (includeFill) target.SetBinding(DirectPath.FillProperty, fillBinding);
     // Dot-dash of line
     if (includeDotDash)
     {
         Binding dashBinding = new Binding("QuickStrokeDash") { Source = this, Mode = BindingMode.OneWay };
         target.SetBinding(DirectPath.QuickStrokeDashProperty, dashBinding);
     }
 }
        private static void OnStrokePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            DirectPath localDirectPath = (DirectPath)obj;

            localDirectPath.SetBrush(((System.Windows.Media.SolidColorBrush)e.NewValue).Color);
        }