Today let us discuss how to navigate from one page to the other page. To navigate from the page it is nothing but we should perform some specific action. We can do this by generating an event. We can generate an event with some particular control. So while we assign an event to the control the page should be navigated. For this we need a control in order to perform some action and we also need a new page. We can do this task with the help of a button. The default event of button is click. So while we click on the button the page should be navigated from one page to the other page. For this we need a button and a new page.
- Open visual studio and create a new blank application.
- Drag and drop a button and edit the contents in property window.
- To add a new page to your application just click on solution explorer window and right click on your project name.
- Select add option and click on add new item After clicking on add new item a page with list of templates can be seen.
- We can select any kind of template regarding your application.
- Simply select blank page and you can also edit the name of your new page.
- In your tool you can see new page with a blank design page.
To navigate from mainpage to the blank page generate an event to the button by clicking on event symbol in properties window. It navigates to the code behind file.
In your button click event add the below code
this.frame.navigate(type of(Blankpage1));
Here in the above code this frame(mainpage) is navigated to the other page, the page type is Blank page. Execute the code and when you click on button the page is navigated from main page to blank page.
No comments:
Post a Comment