private void TCSelectionchanged(object sender, SelectionChangedEventArgs e) { TabControl tc = sender as TabControl; if (tc != null) { if (tc.SelectedItem == Tabcreate) { if (currenttab == "Update") { UCC = new UCCreate(EmployeePositions); } UCCreateContent.Content = UCC; DataGridEmployees.UnselectAll(); TabController.SelectedIndex = 0; TabUpdate.Header = "View Employee"; currenttab = "Create"; } if (tc.SelectedItem == TabUpdate) { if (DataGridEmployees.SelectedItem != null) { UCUpdateContent.Content = UCU = new UCUpdate(SelectedEmployee, TabUpdate, EmployeePositions); TabUpdate.Header = "View Employee"; TabController.SelectedIndex = 1; currenttab = "Update"; } } } }
public MainWindow() { InitializeComponent(); EmployeePositions = BF.GetAllPostions(); DataGridEmployees.SelectedItem = null; ForceRefresh(); UCC = new UCCreate(EmployeePositions); TabController.SelectedIndex = 0; }
private void ForceRefresh() { OCEmployees = BF.GetAllEmployees(); UCC = new UCCreate(EmployeePositions); DataGridEmployees.DataContext = OCEmployees; }