private void Button_Click(object sender, RoutedEventArgs e) { var abc = OpenGrid.Tag as List <Table>; var obj = OpenGrid.SelectedItem; if (tabControl1 != null) { if (tabControl1.SelectedIndex == 0) { abc = OpenGrid.Tag as List <Table>; obj = OpenGrid.SelectedItem; } if (tabControl1.SelectedIndex == 1) { abc = HandleGrid.Tag as List <Table>; obj = HandleGrid.SelectedItem; } if (tabControl1.SelectedIndex == 2) { abc = ClosedGrid.Tag as List <Table>; obj = ClosedGrid.SelectedItem; } } var root = Application.Current.RootVisual as FrameworkElement; AlarmDetail c = new AlarmDetail(obj); //设置子窗口的宽度和长度 c.Width = root.ActualWidth * 0.98; c.Height = root.ActualHeight * 0.98; //子窗口全屏居中 c.HorizontalAlignment = HorizontalAlignment.Center; c.VerticalAlignment = VerticalAlignment.Center; c.Closed += new EventHandler(c_Closed); c.finish.Click += new RoutedEventHandler(finish_Click); c.change.Click += new RoutedEventHandler(change_Click); c.Show(); }
private void Button_Click(object sender, RoutedEventArgs e) { var abc = OpenGrid.Tag as List<Table>; var obj = OpenGrid.SelectedItem; if (tabControl1 != null) { if (tabControl1.SelectedIndex == 0) { abc = OpenGrid.Tag as List<Table>; obj = OpenGrid.SelectedItem; } if (tabControl1.SelectedIndex == 1) { abc = HandleGrid.Tag as List<Table>; obj = HandleGrid.SelectedItem; } if (tabControl1.SelectedIndex == 2) { abc = ClosedGrid.Tag as List<Table>; obj = ClosedGrid.SelectedItem; } } var root = Application.Current.RootVisual as FrameworkElement; AlarmDetail c = new AlarmDetail(obj); //设置子窗口的宽度和长度 c.Width = root.ActualWidth * 0.98; c.Height = root.ActualHeight * 0.98; //子窗口全屏居中 c.HorizontalAlignment = HorizontalAlignment.Center; c.VerticalAlignment = VerticalAlignment.Center; c.Closed += new EventHandler(c_Closed); c.finish.Click += new RoutedEventHandler(finish_Click); c.change.Click += new RoutedEventHandler(change_Click); c.Show(); }