ciao,
ho creato una relazione master-details e legato le tabelle a due DataGrid dgMaster e dgDetails.
Lanciando l'applicazione, le tabelle vengono popolate; ma scorrendo la griglia dgMaster, la griglia dgDetails non si aggiorna. Lo stesso codice eseguito su un'applicazione Windows Form funziona correttamente. Cosa devo fare per ricaricare correttamente la griglia dgDetails?codice:Class myPage Private masterBindingSource As New BindingSource() Private detailsBindingSource As New BindingSource() Private Sub myPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded 'Create a DataSet Dim myDataSet As DataSet = New DataSet() myDataSet.Locale = System.Globalization.CultureInfo.InvariantCulture myDataSet.Tables.Add("TAB_MASTER") myDataSet.Tables.Add("TAB_DETAILS") 'Add data from MASTER table to the DataSet Dim masterDataAdapter As New OdbcDataAdapter("SELECT * FROM TAB_MASTER", ODBCConnection) masterDataAdapter.Fill(myDataSet, "TAB_MASTER") 'Add data from DETAILS table to the DataSet Dim detailsDataAdapter As New OdbcDataAdapter("SELECT * FROM TAB_DETAILS", ODBCConnection) detailsDataAdapter.Fill(myDataSet, "TAB_DETAILS") 'Create a relation Dim relation As New DataRelation("Master_Detail", _ myDataSet.Tables("TAB_MASTER").Columns("CODICE"), _ myDataSet.Tables("TAB_DETAILS").Columns("COD_MASTER")) myDataSet.Relations.Add(relation) 'Bind the master data connector to the MASTER table masterBindingSource.DataSource = myDataSet masterBindingSource.DataMember = "TAB_MASTER" 'Bind the details data connector to the Veicoli table 'using the DataRelation name to filter the information in the 'details table based on the current row in the master table. dgDetails.IsSynchronizedWithCurrentItem = True detailsBindingSource.DataSource = masterBindingSource detailsBindingSource.DataMember = "Master_Detail" dgMaster.ItemsSource = masterBindingSource dgDetails.ItemsSource = detailsBindingSource End Sub End Class

Rispondi quotando