static AddNhanVienWindow() { if (signleton == null) { signleton = new AddNhanVienWindow(); } }
private AddNhanVienWindow() { InitializeComponent(); List <ComboData> ListData = new List <ComboData>(); ListData.Add(new ComboData { Name = "Nam", Value = true }); ListData.Add(new ComboData { Name = "Nu", Value = false }); cbxPhai.ItemsSource = ListData; cbxPhai.SelectedValuePath = "Value"; cbxPhai.DisplayMemberPath = "Name"; cbxPhai.SelectedIndex = 0; Id = 0; EventHandler eventHandler = (o, i) => { signleton = new AddNhanVienWindow(); }; this.Closed += eventHandler; this.DataContext = new ViewModel(); }
private void btnEdit_Click(object sender, RoutedEventArgs e) { if (dgContent.CurrentItem != null) { tableLog.SetRowChange(((DataRowView)dgContent.CurrentItem).Row); AddNhanVienWindow addNhanVienWindow = new AddNhanVienWindow(((DataRowView)dgContent.CurrentItem).Row); addNhanVienWindow.dataGrid = this.dgContent; addNhanVienWindow.Show(); } else { MessageBox.Show("Không có hàng nào được chọn!"); } }