c# - WP: navigation to the page?
I have 10 xaml pages in my Wp app. In every xaml page, i have webbrowser
method to display html page and its content is like below.
1. //.....//
2. //.....//
...
100. //.....//
I decided to have easy navigation. So, i created two textbox, one is for
xaml page and other is for content (1,2, ... 100) So, what my desire is if
user gives, 5 in first textbox and 10 in second textbox it should open
5.xaml and it should be automatically moved to 10. //...//
I have done the code for first textbox. but i dunno how to code for second
textbox.
Here is my code:
TextBox xaml = new TextBox();
xaml.Width = 150;
xaml.MaxLength = 3;
TextBox content = new TextBox();
content.Width = 150;
content.MaxLength = 3;
int num = 0;
if (int.TryParse(xaml.Text, out num) && num > 0 && num < 11)
{
string site;
site = num.ToString();
NavigationService.Navigate(new Uri("/Page" + site + ".xaml",
UriKind.Relative));
}
else
{
MessageBox.Show("Expected Input Range: 1 to 10");
}
No comments:
Post a Comment