mercredi 23 mars 2016

Add a SelectAll CheckBox to a wpf datagrid column?

Please if you can help me, I want to add a selectall checkbox to the first column in my wpf datagrid, how can I do it ? Thanks.

                       <DataGrid.Columns>
                            <DataGridCheckBoxColumn ElementStyle="{DynamicResource MetroDataGridCheckBox}"
                                    EditingElementStyle="{DynamicResource MetroDataGridCheckBox}"
                                    Header="Select"
                                    Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsSelected, Mode=OneWay}"                                                        
                                    />                               

                            <DataGridTextColumn Header="Matricule" Width="100"  Binding="{Binding Matricule}"/>
                            <DataGridTextColumn Header="Nom" Width="80" Binding="{Binding Nom}"/>
                            <DataGridTextColumn Header="Prenom" Width="80" Binding="{Binding Prenom}"/>
                            <DataGridTextColumn Header="Date Recrutement" Width="120" Binding="{Binding Date}"/>
                            <DataGridTextColumn Header="Telephone" Width="100" Binding="{Binding Telephone}"/>
                            <DataGridTextColumn Header="E-mail" Width="120" Binding="{Binding Email}"/>
                            <DataGridTextColumn Header="Compte" Width="80" Binding="{Binding CompteFonct}"/>
                            <DataGridTextColumn Header="Banque\CCP" Width="80" Binding="{Binding CodeBanque}"/>                                

                        </DataGrid.Columns>
                    </DataGrid>




Aucun commentaire:

Enregistrer un commentaire