Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2116
Why does the XamDatagrid lose track of selected items when scrolling?
posted

I'm using MVVM along with this template:

   <Style TargetType="{x:Type igDP:DataRecordPresenter}">

                                <Setter Property="IsSelected"

                                        Value="{Binding DataItem.IsSelected, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />

   </Style>

and I have a IsSelected property in my viewmodel:

    Private _IsSelected As Boolean

    Public Property IsSelected() As Boolean

        Get

            Return _IsSelected

        End Get

        Set(ByVal value As Boolean)

            If value = _IsSelected Then

                Return

            End If

 

            _IsSelected = value

            OnPropertyChanged("IsSelected")

        End Set

    End Property

Selection tracking seem to work fine until you scroll the grid and then random items become selected and selected items lose there selection.  I can see this by showing the IsSelected property field on the grid.  Is there something I'm doing wrong?