c# - How to update binding source for checkbox from template? -
i have template (textblock + checkbox) items in longlistselector wasn't able figure out how refresh binding. checkbox bound boolean property. way worked far navigate same xaml page different parameter "solution" unusable.
i've found examples how use updatesource() textbox none checkbox template.
here checkbox teplate. many things useless, tried found. binding working not refresh have navigate page example , refreshed.
<checkbox borderthickness="2" verticalalignment="center" x:name="templatecheckbox" ischecked="{binding isdone, updatesourcetrigger=explicit, mode=twoway}" checked="templatecheckbox_checked" unchecked="templatecheckbox_checked" /> edit: found easy way how update items in longlistselector. create empty list set itemssource , afterwards set original list itemssource.
<checkbox borderthickness="2" **loaded="onloaded"** verticalalignment="center" x:name="templatecheckbox" ischecked="{binding isdone, updatesourcetrigger=explicit, mode=twoway}" checked="templatecheckbox_checked" unchecked="templatecheckbox_checked" /> private list<checkbox> chklist=new list<checkbox>(); private void onloaded(object sender,eventargs e) { if(!chklist.contians(sender checkbox)) { chklist.add(sender checkbox); } } private void updatesource() { foreach(checkbox chk in chklist) { chk.getbindingexpression(checkbox.ischekcedproperty).updatesource(); } }
Comments
Post a Comment