c# - How to get CheckBox "Ticked" inside ListBox on run time -
c# - How to get CheckBox "Ticked" inside ListBox on run time -
i creating windows phone 8 application, have checkbox within listbox, how checkbox "checked" when click on checkbox?
i tried best not getting result? see code below:
<listbox x:name="listbox1" width="429" height="621" horizontalalignment="left" margin="21,43,0,59" verticalalignment="top" itemssource="{binding}" selecteditem="{binding}" selectionchanged="listbox1_selectionchanged" selectionmode="extended"> <listbox.itemtemplate> <datatemplate> <grid> <stackpanel orientation="vertical" width="440"> <stackpanel orientation="horizontal"> <textblock text="{binding}" textwrapping="wrap" foreground="black" fontsize="22" height="30" textalignment="left" width="auto" fontweight="semibold"/> <textblock text="{binding}" textwrapping="wrap" foreground="black" fontsize="22" margin="5" height="30" textalignment="left" width="auto" fontweight="semibold"/> </stackpanel> <stackpanel> <textblock text="favorite" textwrapping="wrap" foreground="black" fontsize="22" height="30" fontweight="semibold" margin="344,-35,9,0"/> </stackpanel> <stackpanel orientation="horizontal"> <textblock text="{binding}" textwrapping="wrap" foreground="black" fontsize="22" height="auto" width="auto" textalignment="left" fontweight="semibold"/> </stackpanel> <checkbox x:name="checkbox1" height="72" foreground="black" ischecked="false" margin="353,-40,28,0" borderbrush="black" loaded="checkbox1_loaded" checked="checkbox1_checked" unchecked="checkbox1_unchecked"/> </stackpanel> </grid> </datatemplate> </listbox.itemtemplate> </listbox>
here code behind file:
private void checkbox1_checked(object sender, routedeventargs e) { checkbox cb = (checkbox)sender; cb.ischecked = true; }
i tried on emulator in listbox , works fine. textboxes checked , unchecked without problem.
c# windows-phone-8 checkbox
Comments
Post a Comment