private void DefinePath()
{
if (StartPort.Origin == null || EndPort.Origin == null) return;
var spline = new BezierSegment {IsStroked = true};
var b = new Binding("Point")
{
Source = StartBezierPoint,
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(spline, BezierSegment.Point1Property, b);
b = new Binding("Point")
{
Source = EndBezierPoint,
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(spline, BezierSegment.Point2Property, b);
b = new Binding("Point")
{
Source = EndPort.Origin,
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(spline, BezierSegment.Point3Property, b);
var pColl = new PathSegmentCollection {spline};
var pFig = new PathFigure(StartPort.Origin.Point, pColl, false);
b = new Binding("Point")
{
Source = StartPort.Origin,
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(pFig, PathFigure.StartPointProperty, b);
var pfColl = new PathFigureCollection {pFig};
Path.Data = new PathGeometry(pfColl);
}