private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (GeneralTab.IsSelected && previousItem != GeneralTab) { previousItem = GeneralTab; DataContext = new GeneralTabViewModel(this); } else if (StatisticsTab.IsSelected && previousItem != StatisticsTab) { previousItem = StatisticsTab; DataContext = new StatisticsTabViewModel(this); } else if (TrackingTab.IsSelected && previousItem != TrackingTab) { previousItem = TrackingTab; DataContext = new TrackingTabViewModel(this); } else if (DataInputTab.IsSelected) { if (CitizenTab.IsSelected && previousItem != CitizenTab) { previousItem = CitizenTab; DataContext = new CitizenTabViewModel(this); } else if (TestCaseTab.IsSelected && previousItem != TestCaseTab) { previousItem = TestCaseTab; DataContext = new TestCaseTabViewModel(this); } else if (TestCenterTab.IsSelected && previousItem != TestCenterTab) { previousItem = TestCenterTab; DataContext = new TestCenterTabViewModel(this); } else if (LocationTab.IsSelected && previousItem != LocationTab) { previousItem = LocationTab; DataContext = new LocationTabViewModel(this); } else if (LocationVisitTab.IsSelected && previousItem != LocationVisitTab) { previousItem = LocationVisitTab; DataContext = new LocationVisitTabViewModel(this); } } }
public MainWindow() { InitializeComponent(); DataContext = new GeneralTabViewModel(this); }