c# - Dynamic binding between control in WP7 XAML -
i trying draw simple line in wp7 xaml such 1 below. static coordinate values works fine.
<line stroke="white" x1="1" y1="1" x2="200" y2="1" />
what need bind coordinate values relative other controls on same canvas based on matching property value such id or name. once correct control bound, need left and/or top canvas locations. using vague pseudocode, here able do...
<line stroke="white" x1="{binding canvas.left, source={binding <a_control_where_a_property_equals_some_value>}}" y1="1" x2="200" y2="1" />
i've tried number of binding scenarios no success. complexity windows phone 7 (wp7) binding , not full blown xaml.
note: controls added @ runtime not statically defined.
any suggestions???
the best can hope use elementname. other that, you'd need expose common property somewhere both controls bound to. possibly in view-model, depends on setup.
sample of elementname:
<canvas> <line x:name="line1" stroke="white" x1="1" y1="1" x2="200" y2="1" /> <line stroke="white" x1="{binding elementname=line1, path=x1}" y1="10" x2="200" y2="1" /> </canvas>
Comments
Post a Comment