raghav mac

raghav mac

  • NA
  • 4
  • 1.3k

Save the state of checkbox(inlistbox) IsChecked property

May 6 2013 10:07 AM
I created a button to create multiple checkbox inside a listbox item template on no. of clicks for wp7. Below the codes I used for it.
 
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
   <TextBox x:Name="txtNewTask" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="328"/>
   <Button x:Name="btnAdd" Content="add" HorizontalAlignment="Left" Margin="328,0,0,0" VerticalAlignment="Top" Width="123" Click="btnAdd_Click"/>
   <ListBox x:Name="lbToDoList" Margin="0,72,0,0">
     <ListBox.ItemTemplate>
       <DataTemplate>
         <CheckBox Click="CheckBox_Click" Background="{x:Null}">
           <StackPanel Orientation="Horizontal">
             <TextBlock Text="{Binding}" Name="tbkTextName" VerticalAlignment="Center" Margin="5,0,5,0" />
           </StackPanel>
         </CheckBox>
       </DataTemplate>
     </ListBox.ItemTemplate>
   </ListBox>
</Grid>

Now when the app is re-launched my app, the checkbox's are unchecked (default state) and its state is not saved. Can you please help me to save the multiple checkbox's(inside listbox item template) value or state?