I am making a WPF application with a sidebar for navigating through different pages which are loaded onto a frame. As any other sidebar, the clicked sidebar radiobutton is highlighted when clicked.
Now, the problem I am facing is that the pages I need to navigate to are rather heavy, with about 20 checkboxes, 20 textboxes, 20 labels, and some more controls. So on the click of the radiobutton on the sidebar, there is a considerable delay till the page being navigated and thus the radiobutton being highlighted. I managed to show a loading window everytime the frame is navigating, however I can't think of a way to remove the delay between the radiobutton being clicked and being highlighted.
CodePudding user response:
The problem is that you are not preloading your pages you can switch easily form this
PagesNavigation.Navigate(new MyPage());
to this
MyPage mypage = new MyPage(); // Place this line in your init method PagesNavigation.Navigate(mypage); // Replace the previous navigate with this line
In this way all your load time will be at the start of the application (or where you place the initialization) and also you doesn't recreate several time the same page.