A list of ellipses and lines are added as Children to LayoutRoot. Lines are connecting between ellipses. How to bind these two elements together so that when ellipse moves lines should also move. How to bind the X1property,X2property,Y1property,Y2property to center of ellipses.
views:
14answers:
1
A:
- Assume that the parent is a Canvas
- Create a ValueConverter CenterPointConverter that converts the Ellipse into the X or Y value of the center, depending on the ConverterParameter
use element-to-element binding
<Line X1="{Binding Ellipse1, Converter={StaticResource CenterPointConverter}, ConverterParameter=X}" X2="{Binding Ellipse2, Converter={StaticResource CenterPointConverter}, ConverterParameter=X}" Y1="{Binding Ellipse1, Converter={StaticResource CenterPointConverter}, ConverterParameter=Y}" X1="{Binding Ellipse2, Converter={StaticResource CenterPointConverter}, ConverterParameter=Y}"/>
Michael S. Scherotter
2010-10-02 19:42:55