private static void HandleCanvasBindingPathChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var propertyPath = e.NewValue as string;
if (propertyPath != null)
{
var canvasProperty =
e.Property == CanvasLeftBindingPathProperty
? Canvas.LeftProperty
: Canvas.TopProperty;
BindingOperations.SetBinding(
d,
canvasProperty,
new Binding { Path = new PropertyPath(propertyPath) });
}
}