//if the user selects a list view item private void ControlList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListView listView = e.Source as ListView; if (listView != null) { //clear the main content panel MainContentPanel.Children.Clear(); if (listView.SelectedItem.Equals(lsviLendOut)) { //set the AddData user control to occupy the second grid Control controlAddRecord = new AddData(); this.MainContentPanel.Children.Add(controlAddRecord); } if (listView.SelectedItem.Equals(lsviViewLentOut)) { //set ViewLent user control to ocuppy the second grid Control controlViewLent = new ViewLent(); this.MainContentPanel.Children.Add(controlViewLent); } if (listView.SelectedItem.Equals(lsviSearch)) { //set ViewLent user control to ocuppy the second grid Control controlSearch = new Search(); this.MainContentPanel.Children.Add(controlSearch); } } }
public MainWindow() { InitializeComponent(); //sets the AddData page as default when application first starts Control controlAddRecord = new AddData(); MainContentPanel.Children.Add(controlAddRecord); }