void newmenuitem_Click(object sender, RoutedEventArgs e) { subwindow_content.Children.Clear(); sub_addelement newadd = new sub_addelement(); subwindow.Width = 400; subwindow.Height = 400; newadd.Name = "newadd"; subwindow.Opacity = 0.9; subwindow_content.Children.Add(newadd); Panel.SetZIndex(submainwindow, 3000); fcb_public.publicDataSet publicDataSet = ((fcb_public.publicDataSet)(this.FindResource("publicDataSet"))); // 将数据加载到表 elset_init 中。可以根据需要修改此代码。 fcb_public.publicDataSetTableAdapters.elset_initTableAdapter publicDataSetelset_initTableAdapter = new fcb_public.publicDataSetTableAdapters.elset_initTableAdapter(); publicDataSetelset_initTableAdapter.Fill(publicDataSet.elset_init); System.Windows.Data.CollectionViewSource elset_initViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("elset_initViewSource"))); elset_initViewSource.View.MoveCurrentToFirst(); // 将数据加载到表 Initialize 中。可以根据需要修改此代码。 fcb_public.publicDataSetTableAdapters.InitializeTableAdapter publicDataSetInitializeTableAdapter = new fcb_public.publicDataSetTableAdapters.InitializeTableAdapter(); var query = from c in publicDataSet.Initialize join t in publicDataSet.elset_init on c.ID equals t.Initialize_ID select c; //publicDataSetInitializeTableAdapter.Fill(query); System.Windows.Data.CollectionViewSource initializeViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("initializeViewSource"))); initializeViewSource.View.MoveCurrentToFirst(); }
void newadd_AddElement(object sender, RoutedPropertyChangedEventArgs <object> e) { sub_addelement newadd = new sub_addelement(); subwindow.Width = 400; subwindow.Height = 400; newadd.Name = "newroll"; subwindow.Opacity = 0.9; subwindow_content.Children.Add(newadd); Panel.SetZIndex(submainwindow, 3000); }
private void show_window_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { sub_show newshow = new sub_show(); newshow.Width = 700; newshow.Height = 800; //newshow.HorizontalAlignment = HorizontalAlignment.Center; //newshow.Margin = new Thickness(0, 200, 0, 0); DataObject data = new DataObject(typeof(sub_show), newshow); DragDrop.DoDragDrop(newshow, data, DragDropEffects.Copy); sub_addelement newadd = new sub_addelement(); }