mercredi 27 mai 2015

Combobox with "Select All" CheckBox in SilverLight

I've ComboBox where I am binding list which will appear with CheckBox. Now I want to add "Select All" with CheckBox and when user select that, remaining all CheckBoxshould get selected. Following is my code where "Select All" appears before all items but I just want it once.

CODE:

<ComboBox x:Name="SynonymsCmbBx" ItemsSource="{Binding Synonyms}" Width="250" MaxDropDownHeight="100"  Margin="0,0,375,0"  ScrollViewer.VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <CheckBox Content="Select All" Height="16" Name="checkBox1" IsChecked="True" FontWeight="Bold" />
                <CheckBox Content="{Binding Display}" Margin="10,0,0,0" IsChecked="{Binding Path=IsChecked, ElementName=checkBox1}" />
                <!--<CheckBox Content="{Binding Display}" Margin="10,0,0,0" />-->
            </StackPanel>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ComboBox>

OUTPUT:

enter image description here




Aucun commentaire:

Enregistrer un commentaire