Click here to Skip to main content
14,640,736 members
Rate this:
Please Sign up or sign in to vote.
I have created a Datagrid with 3 columns. One of the columns is a Checkbox. The checkbox is used to select the item in the Datagrid.

I have used the XAML code below to create the datagrid. There is no Code behind which interacts about checkin the checkbox. However, when i check checkboxes and i scroll down. Some of the Checkboxes i never checked become checked. Also, the checkboxes i checked randomly stay checked or uncheck. I have filmed the problem and uploaded it to youtube. You can find the link below. I have added subtitles to explain what is happening.

Anyone have a clue on why this keeps happening and how to stop it?

<DataGrid x:Name="Lbox" CanUserDeleteRows="False" Margin="10,86,519.333,-0.333"
                        ItemsSource="{Binding Items}" CanUserAddRows="false" AutoGenerateColumns="False">
                            <DataGridTemplateColumn Header="DUT">
                                        <CheckBox x:Name="checkboxinstance"/>
                            <DataGridTextColumn Binding="{Binding DraadNr}" Header="DraadNr" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding Naam}" Header="Draadlijst" IsReadOnly="True" />


What I have tried:

I have googled the problem, but i could not find a problem which is nearly the same as mine.
Updated 6-Dec-18 1:45am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

This happens because of Data Virtualization, you can resolve it by applying the following code to your datagrid control

For more info on virtualization you can check this
Member 13947785 7-Dec-18 3:04am
When i scroll down with the VirtualizationMode on Standard. Only the last checked checkbox will stay checked. The other uncheck

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100