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
50
Retrieve Modified Records/Objects from XamDataGrid with MVVM Pattern
posted

I have a XamDataGrid bound to an ObservableCollection in my ViewModel:

public ObservableCollection<InventurPos> LoadedPositions { get; set; }

XAML:

<custom:XamDataGrid Name="InvPosDisplay" Grid.Row="2" Grid.Column="2" DataSource="{Binding LoadedPositions}">
            <custom:XamDataGrid.FieldLayoutSettings>
                <custom:FieldLayoutSettings AutoGenerateFields="False"/>
            </custom:XamDataGrid.FieldLayoutSettings>
            <custom:XamDataGrid.FieldSettings>
                <custom:FieldSettings AllowRecordFiltering="True" LabelClickAction=dNotificationsActive="True"/>
            </custom:XamDataGrid.FieldSettings>
            <custom:XamDataGrid.ViewSettings>
                <custom:GridViewSettings />
            </custom:XamDataGrid.ViewSettings>
            
            <custom:XamDataGrid.FieldLayouts>
        ...
            </custom:XamDataGrid.FieldLayouts>

        </custom:XamDataGrid>

I already managed to do this in the Code behind, using the Eventhandler OnRecordUpdated, however since i have to process some more extensive Logic to fill some Properties that are not editable by the User, i'd prefer having this Logic in my Viewmodel. Is there any Way to get the modified row(s) from the ViewModel?

(I already tried registering an OnCollectionChanged Handler to my ObservableCollection, this Changed however are not getting picked up, probably due to not raising a PropertyChangedEvent)