private void BtnMod_Click(object sender, RoutedEventArgs e) { ImageButtonWithIcon item = sender as ImageButtonWithIcon; //修改 if (item.Content.ToString().Contains("主项")) { gbItem.DataContext = gridItem.SelectedItem; gbItem.IsCollapsed = false; gbItem.Visibility = Visibility.Visible; } else { if (this.gridItem.SelectedItem == null) { return; } RsMaintainStandards selectItem = this.gridItem.SelectedItem as RsMaintainStandards; Window win = new MaintainStandardsDetailEdit(false, selectItem); win.Height = 500; win.Width = 795; win.WindowStyle = WindowStyle.None; win.WindowStartupLocation = WindowStartupLocation.CenterScreen; win.Closed += Win_Closed; win.Title = "修改明细"; win.ShowDialog(); } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { ImageButtonWithIcon item = sender as ImageButtonWithIcon; //新增 if (item.Content.ToString().Contains("主项")) { RsMaintainStandards MaintainStandards = new RsMaintainStandards() { CREATION_DATE = DateTime.Now, LAST_UPDATE_DATE = DateTime.Now, //最后修改日期 USE_FLAG = 1, //启用 }; gbItem.DataContext = MaintainStandards; gbItem.IsCollapsed = false; gbItem.Visibility = Visibility.Visible; } else { if (this.gridItem.SelectedItem == null) { return; } RsMaintainStandards selectItem = this.gridItem.SelectedItem as RsMaintainStandards; Window win = new MaintainStandardsDetailEdit(true, selectItem); win.Height = 500; win.Width = 795; win.WindowStyle = WindowStyle.None; win.WindowStartupLocation = WindowStartupLocation.CenterScreen; win.Closed += Win_Closed; win.Title = "新增明细"; win.ShowDialog(); } }