ume mariyam

ume mariyam

  • 2.1k
  • 60
  • 351

How to check all the checkboxes when selectAll is clicked.

Aug 2 2017 1:57 AM
I have a dynamic listbox and a checkbox inside it.I want all the checkboxes to get checked when selectAll is clicked.
 
Here is Xaml code: 
<StackPanel Width="400" Orientation="Horizontal" Grid.Row="0"> <AppBarButton x:Name="Btn_SelectAll" Margin="20,0,0,0" Label="Select All" Icon="SelectAll" Click="Btn_SelectAll_Click" FontWeight="Bold" /> <AppBarButton x:Name="Btn_Delete" Margin="150,0,0,0" Label="Delete All" Icon="Delete" Click="DeleteAll_Click" FontWeight="Bold" /> </StackPanel> <ListBox x:Name="listBoxobj" Background="Transparent" Margin="6" Height="auto" BorderThickness="2" MaxHeight="580" Grid.Row="1" SelectionChanged="listBoxobj_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <CheckBox Name="Option1CheckBox" VerticalAlignment="Center" Margin="5,0,0,0" /> <TextBlock x:Name="NameTxt" TextWrapping="Wrap" Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="22" Foreground="White"/> <TextBlock x:Name="Age" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="White" FontSize="22" Text="{Binding Age}" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox>
 

Answers (1)