I am trying to call a method when I update one of the fields in my DataGrid. Right now, I have tried multiple different options but none will even call a method or DelegateCommand I have created. Here is the code for my DataGrid:
<DataGrid x:FieldModifier="public" x:Name="Classes" CanUserAddRows="False" AutoGenerateColumns="False" CanUserResizeColumns="False" AlternatingRowBackground="LightBlue" ItemsSource="{Binding Classes, Mode=TwoWay}" SelectedItem="{Binding SelectedClass}" >
<DataGrid.Columns>
<DataGridTextColumn Width="200" Header="Class" Binding="{Binding Class, Mode=TwoWay}" IsReadOnly="True"/>
<DataGridTextColumn Width="200" Header="Semester" Binding="{Binding Semester, Mode=TwoWay}" IsReadOnly="True"/>
<DataGridTextColumn Width="200" Header="Date Due" Binding="{Binding Date_Due, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
<DataGridTextColumn Width="200" Header="Importance" Binding="{Binding Importance, Mode=TwoWay}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
The Data Grid is bound to an Observable collection of an object I created. When the user updates the Date_Due field, I want to call a method in my ViewModel to update the database with the change. How would I go about doing this?
I am using an MVVM pattern so I don't have any code-behind.
Any help is appreciated.