internal void BindEllipse(Ellipse ellipse, PlotPointViewRenderer point) { Binding topBinding = new Binding(); topBinding.Path = new PropertyPath("Y"); topBinding.Mode = BindingMode.OneWay; topBinding.Source = point; ellipse.SetBinding(Canvas.TopProperty, topBinding); Binding leftBinding = new Binding(); leftBinding.Path = new PropertyPath("X"); leftBinding.Mode = BindingMode.OneWay; leftBinding.Source = point; ellipse.SetBinding(Canvas.LeftProperty, leftBinding); Binding colorBinding = new Binding(); colorBinding.Path = new PropertyPath("InnerColor"); colorBinding.Mode = BindingMode.OneWay; colorBinding.Source = point; colorBinding.Converter = ColorBrushConverter.Instance; ellipse.SetBinding(Ellipse.FillProperty, colorBinding); Binding strokeBinding = new Binding(); strokeBinding.Path = new PropertyPath("OuterColor"); strokeBinding.Mode = BindingMode.OneWay; strokeBinding.Source = point; strokeBinding.Converter = ColorBrushConverter.Instance; ellipse.SetBinding(Ellipse.StrokeProperty, strokeBinding); Binding widthBinding = new Binding(); widthBinding.Path = new PropertyPath("Width"); widthBinding.Mode = BindingMode.OneWay; widthBinding.Source = point; ellipse.SetBinding(Ellipse.WidthProperty, widthBinding); Binding heightBinding = new Binding(); heightBinding.Path = new PropertyPath("Height"); heightBinding.Mode = BindingMode.OneWay; heightBinding.Source = point; ellipse.SetBinding(Ellipse.HeightProperty, heightBinding); }
internal void CreatePlotGraph(PlotGraph plotGraph) { this.ResetPlotGraph(); foreach (PlotPoint point in plotGraph.PlotPoints) { Ellipse e = new Ellipse(); PlotPointViewRenderer pointRenderer = new PlotPointViewRenderer(this, point); this.BindEllipse(e, pointRenderer); this.CnvsPlotGraph.Children.Add(e); } }