Wpf Listview Multi Select w/checkbox

Would like to build Listview(listbox) containing a checkbox with the ability to select as many checkbox's desired, and then update DB (codebehind) with data from the screen. I'll just read thru Listview and update. 

Example. On the screen user would enter a valid Sku# in a textbox, the user would see a Listview containing a listview of valid products, user would select (checkbox) as many rows desired and then click an update button. Behind code would read thru the listview and anything checked I would update DB.

I am unsure how to setup Listview currectly with checkbox and multi select Wondering if anynody has a working example of a WPF solution that has either Listview/Listbox with checkbox option with multi select. I know this is a very specific requerst, feel free to send me an email. Thanks


Marc Hinrichen


  • Hi

    I would like to ask you where the problem is. Is it to define the Listview with XAML, or is it the handling of the of the Ceckbox Status in the Listview Items?

    Freundliche Grüsse

    Werner Lanter

  • My Listview layout (below) is what I have defined. Not sure if I need relativesource stmnt, but was in the example I found. I guess my question now is when I read thru the Listview in behind code, how do I determine if the checkbox was 'Checked'? Not sure what proprty value to go after.

    I will read thru the Listview row by row, and if the row was checked, I will perform an update, otherwise move onto the next row.



                       <GridViewColumn Header="Ven#" Width="50"

                                           DisplayMemberBinding="{Binding Path=Vs_Vnd}"></GridViewColumn>

                       <GridViewColumn Header="Name" Width="150"

                                           DisplayMemberBinding="{Binding Path=AP_Name}"></GridViewColumn>

                       <GridViewColumn Header="Sku #" Width="170" TextBlock.TextAlignment="Center"

                                           DisplayMemberBinding="{Binding Path=Vs_Sku}"></GridViewColumn>

                       <GridViewColumn Header="Whse" Width="40"

                                           DisplayMemberBinding="{Binding Path=Vs_Pc_W}"></GridViewColumn>

                       <GridViewColumn Header="Direct" Width="40"

                                           DisplayMemberBinding="{Binding Path=Vs_Pc_D}"></GridViewColumn>

                       <GridViewColumn Header="Lumber" Width="40"

                                           DisplayMemberBinding="{Binding Path=Vs_Pc_Lbr}"></GridViewColumn>

                       <GridViewColumn Header="Panels" Width="40"

                                           DisplayMemberBinding="{Binding Path=Vs_Pc_Ply}"></GridViewColumn>

                       <GridViewColumn Header="?" Width="40">




                                       <!--<CheckBox IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource Self},Mode=TwoWay}"/>-->

                                       <CheckBox Name="chk1" IsChecked="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"/>





                       <GridViewColumn Header="Vendor Product Description" Width="520"

                                           DisplayMemberBinding="{Binding Path=Vs_Desc}"></GridViewColumn>

                       <GridViewColumn Header="# Times Rcv" Width="50"

                                           DisplayMemberBinding="{Binding Path=Vs_Edm_Count}"></GridViewColumn>




  • Did you receive my solution and could you find what you need?


    Werner Lanter