I have a View with a dataGrid:
<DataGrid x:Name="DARViewer"
AutoGenerateColumns="True"
ItemsSource="{Binding DataSourceTable,
NotifyOnSourceUpdated=True,
UpdateSourceTrigger=Default}" />
I have also 10 buttons and every time that I click on one I call a command that updates the DataSourceTable (is a datatable property in my ViewModel).
The code is working fine, and every time I click on a button my datagrid has the corresponding data.
My problem is that I cannot find an datagrid event that is raised every time the DataSourceTable is changed.
PS. I tried DARViewer.DataContextChanged(that makes sense) and DARViewer.SourceUpdated but they are not working
The command that is executed by the buttons is:
Private Sub LoadReportExecute(sender)
Id = sender.DataContext.Id
ChangeDataSourceTable()
End Sub
Public Sub ChangeDataSourceTable()
DataSourceTable = Nothing
DataSourceTable = ExecuteCommand(DataSource) 'that just returns a datatable
End Sub
Private mdtDataSourceTable As DataTable
Public Property DataSourceTable() As DataTable
Get
Return mdtDataSourceTable
End Get
Set(ByVal value As DataTable)
mdtDataSourceTable = value
RaisePropertyChanged("DataSourceTable")
End Set
End Property