Пример #1
0
        protected void Initialize()
        {
            line                = new PlotPath();
            markers             = new PlotPath();
            line.StrokeLineJoin = PenLineJoin.Bevel;
            line.Visibility     = Visibility.Visible;
            markers.Visibility  = Visibility.Visible;
            //
            annotation = new PlotPointAnnotation();
            //
            legendItem = CreateLegendItem();
            //
            // Name binding
            Binding titleBinding = new Binding("Title")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            legendItem.SetBinding(LegendItem.TitleProperty, titleBinding);
            // Other bindings:
            BindToThis(line, false, true);
            BindToThis(legendLine, false, true);
            BindToThis(markers, true, false);
            BindToThis(legendMarker, true, false);
        }
Пример #2
0
        protected virtual LegendItem CreateLegendItem()
        {
            LegendItem legendItem     = new LegendItem();
            Grid       legendItemGrid = new Grid();

            legendLine   = new PlotPath();
            legendMarker = new PlotPath();
            legendMarker.HorizontalAlignment = HorizontalAlignment.Center; legendMarker.VerticalAlignment = VerticalAlignment.Center;
            legendLine.HorizontalAlignment   = HorizontalAlignment.Center; legendLine.VerticalAlignment = VerticalAlignment.Center;
            legendLine.Data = new LineGeometry(new Point(0, 0), new Point(30, 0));
            legendItemGrid.Children.Add(legendLine);
            legendItemGrid.Children.Add(legendMarker);
            legendItem.Content = legendItemGrid;
            return(legendItem);
        }
Пример #3
0
        protected void BindToThis(PlotPath 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(PlotPath.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(PlotPath.StrokeThicknessProperty, strokeThicknessBinding);
            // Fill binding
            Binding fillBinding = new Binding("MarkersFill")
            {
                Source = this, Mode = BindingMode.OneWay
            };

            if (includeFill)
            {
                target.SetBinding(PlotPath.FillProperty, fillBinding);
            }
            // Dot-dash of line
            if (includeDotDash)
            {
                Binding dashBinding = new Binding("QuickStrokeDash")
                {
                    Source = this, Mode = BindingMode.OneWay
                };
                target.SetBinding(PlotPath.QuickStrokeDashProperty, dashBinding);
            }
        }
Пример #4
0
 protected void BindToThis(PlotPath 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(PlotPath.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(PlotPath.StrokeThicknessProperty, strokeThicknessBinding);
     // Fill binding
     Binding fillBinding = new Binding("MarkersFill") { Source = this, Mode = BindingMode.OneWay };
     if (includeFill) target.SetBinding(PlotPath.FillProperty, fillBinding);
     // Dot-dash of line
     if (includeDotDash)
     {
         Binding dashBinding = new Binding("QuickStrokeDash") { Source = this, Mode = BindingMode.OneWay };
         target.SetBinding(PlotPath.QuickStrokeDashProperty, dashBinding);
     }     
 }
Пример #5
0
 protected virtual LegendItem CreateLegendItem()
 {
     LegendItem legendItem = new LegendItem();
     Grid legendItemGrid = new Grid();
     legendLine = new PlotPath();
     legendMarker = new PlotPath();
     legendMarker.HorizontalAlignment = HorizontalAlignment.Center; legendMarker.VerticalAlignment = VerticalAlignment.Center;
     legendLine.HorizontalAlignment = HorizontalAlignment.Center; legendLine.VerticalAlignment = VerticalAlignment.Center;
     legendLine.Data = new LineGeometry(new Point(0, 0), new Point(30, 0));
     legendItemGrid.Children.Add(legendLine);
     legendItemGrid.Children.Add(legendMarker);
     legendItem.Content = legendItemGrid;
     return legendItem;
 }
Пример #6
0
 protected void Initialize()
 {
     line = new PlotPath();
     markers = new PlotPath();
     line.StrokeLineJoin = PenLineJoin.Bevel;
     line.Visibility = Visibility.Visible;
     markers.Visibility = Visibility.Visible;
     //
     annotation = new PlotPointAnnotation();
     //
     legendItem = CreateLegendItem();
     //
     // Name binding
     Binding titleBinding = new Binding("Title") { Source = this, Mode = BindingMode.OneWay };
     legendItem.SetBinding(LegendItem.TitleProperty, titleBinding);
     // Other bindings:
     BindToThis(line, false, true);
     BindToThis(legendLine, false, true);
     BindToThis(markers, true, false);
     BindToThis(legendMarker, true, false);
 }