private void UserControl_Loaded(object sender, RoutedEventArgs e) { string connection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\MyDB.mdb;Persist Security Info=True"; DataStoreModel sourceData = new DataStoreModel(connection); DataStoreViewModel sourceDataModel = new DataStoreViewModel(sourceData); this.MyVisualControl.DataContext = sourceDataModel; }
public DataStoreViewModel(DataStoreModel dataStore) { if (dataStore == null) { throw new ArgumentNullException("dataStore"); } this.dataStore = dataStore; }