jeudi 8 décembre 2016

WPF multiple ID's with Datagrid Checkboxes

I'm working on a school project right now where I wanted to challange myself, so I thaught myself how to work with WPF Applications but I ran into an issue which I can't figure out myself. The issue I'm having is, that I can't select multiple ID's from the row where the checkboxes are checked.

What should the program do with the ID's?

  1. Select x ID's
  2. Open a new window foreach found ID

Pictures showing the Programm:

Window

Designer Code

So if the user presses one of the buttons on the topleft after selecting atleast one row with a checkbox the program should select the ID's from the column[0] "Kunden-Nr".
I can only manage to do it with a single row with a doubleclick event which selects the value from the first column of the selected row.

I hope I gave enough informatio for you to understand my problem since its my first time asking a question here.
If you need any other information to help me, please let me know I will try to provide it as soon as possible.
(Sorry for the German variable name, in school projects I tend to do it so my classmates can understand it easier)

Datagrid Designer Code for people that don't want to open the picture.

<Grid Grid.Row="1" Grid.Column="1">
                    <DataGrid x:Name="dgvCustomerOverview" AutoGenerateColumns="False">
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding KD_NR}" Header="Kunden-Nr" Width="0.7*"/>
                            <DataGridTextColumn Binding="{Binding KD_Name}" Header="Name" Width="*"/>
                            <DataGridTemplateColumn Header="Geburtstag" Width="*">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Style="{StaticResource dgvPadding}" Text="{Binding KD_Gebtag, StringFormat=\{0:dd.MM.yy\}}"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTextColumn Binding="{Binding KD_Plz}" Header="Postleitzahl" Width="0.75*"/>
                            <DataGridTextColumn Binding="{Binding KD_Ort}" Header="Ort" Width="*"/>
                            <DataGridTextColumn Binding="{Binding KD_Strasse}" Header="Straße" Width="*"/>
                            <DataGridTextColumn Binding="{Binding KD_HausNr}" Header="Haus-Nr" Width="0.55*"/>
                            <DataGridTextColumn Binding="{Binding KD_Email}" Header="E-Mail" Width="*"/>
                            <DataGridTextColumn Binding="{Binding KD_Privattel}" Header="Tel. Privat" Width="*"/>
                            <DataGridTextColumn Binding="{Binding KD_Mobiltel}" Header="Tel. Mobil" Width="*"/>
                            <DataGridCheckBoxColumn Header="Auswählen" Width="0.75*"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>

Aucun commentaire:

Enregistrer un commentaire