wpf - Why does binding expression detach in OneWay mode? -
could explain me why first binding expression detached after click checkbox3 object...
<stackpanel> <checkbox x:name="chackbox1" content="checkbox1" ischecked="{binding elementname=chackbox2, path=ischecked, mode=oneway}" /> <checkbox x:name="chackbox2" content="checkbox2" ischecked="false" /> <checkbox x:name="chackbox3" content="checkbox3" ischecked="{binding elementname=chackbox1, path=ischecked, mode=twoway}" /> </stackpanel>
...and not happen in following scenario...
<stackpanel> <checkbox x:name="chackbox1" content="checkbox1" ischecked="{binding elementname=chackbox2, path=ischecked, mode=twoway}" /> <checkbox x:name="chackbox2" content="checkbox2" ischecked="false" /> <checkbox x:name="chackbox3" content="checkbox3" ischecked="{binding elementname=chackbox1, path=ischecked, mode=twoway}" /> </stackpanel>
...where mode changed twoway in first binding expression?
i'm asking explanation. know how omit tricky situation , know how debug binding expressions. found similar post here there no clear answer general problem.
in first scenario, checkbox1 has oneway
binding, cannot accept changes value except via checkbox2. if checkbox3 tries set checkbox1 invalidate binding, , set raw value.
if want checkbox3 set checkbox1 (which updates checkbox2) rather oneway
binding need onewaytosource
Comments
Post a Comment