private void Window_Loaded(object sender, RoutedEventArgs e) { ShopApp.InventoryDataSet inventoryDataSet = ((ShopApp.InventoryDataSet)(this.FindResource("inventoryDataSet"))); // Load data into the table Njesite. You can modify this code as needed. ShopApp.InventoryDataSetTableAdapters.NjesiteTableAdapter inventoryDataSetNjesiteTableAdapter = new ShopApp.InventoryDataSetTableAdapters.NjesiteTableAdapter(); inventoryDataSetNjesiteTableAdapter.Fill(inventoryDataSet.Njesite); System.Windows.Data.CollectionViewSource njesiteViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("njesiteViewSource"))); njesiteViewSource.View.MoveCurrentToFirst(); // Load data into the table Groups. You can modify this code as needed. ShopApp.InventoryDataSetTableAdapters.GroupsTableAdapter inventoryDataSetGroupsTableAdapter = new ShopApp.InventoryDataSetTableAdapters.GroupsTableAdapter(); inventoryDataSetGroupsTableAdapter.Fill(inventoryDataSet.Groups); System.Windows.Data.CollectionViewSource groupsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("groupsViewSource"))); groupsViewSource.View.MoveCurrentToFirst(); // Load data into the table SubGroups. You can modify this code as needed. ShopApp.InventoryDataSetTableAdapters.SubGroupsTableAdapter inventoryDataSetSubGroupsTableAdapter = new ShopApp.InventoryDataSetTableAdapters.SubGroupsTableAdapter(); inventoryDataSetSubGroupsTableAdapter.Fill(inventoryDataSet.SubGroups); System.Windows.Data.CollectionViewSource subGroupsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("subGroupsViewSource"))); subGroupsViewSource.View.MoveCurrentToFirst(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { // Do not load your data at design time. if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { //Load your data here and assign the result to the CollectionViewSource. ShopApp.InventoryDataSet inventoryDataSet = ((ShopApp.InventoryDataSet)(this.FindResource("inventoryDataSet"))); // Load data into the table Reparts. You can modify this code as needed. ShopApp.InventoryDataSetTableAdapters.GroupsTableAdapter inventoryDataSetRepartsTableAdapter = new ShopApp.InventoryDataSetTableAdapters.GroupsTableAdapter(); inventoryDataSetRepartsTableAdapter.Fill(inventoryDataSet.Groups); System.Windows.Data.CollectionViewSource repartsViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("groupsViewSource"))); repartsViewSource.View.MoveCurrentToFirst(); ShopApp.InventoryDataSetTableAdapters.SubGroupsTableAdapter inventoryDataSetRepartsTableAdapters = new ShopApp.InventoryDataSetTableAdapters.SubGroupsTableAdapter(); inventoryDataSetRepartsTableAdapters.Fill(inventoryDataSet.SubGroups); System.Windows.Data.CollectionViewSource repartsViewSources = ((System.Windows.Data.CollectionViewSource)(this.FindResource("subGroupsViewSource"))); repartsViewSources.View.MoveCurrentToFirst(); LoadData(); } }