Go to another page when you click

I developed a Windows mobile application . I added a button for VS blend 2015 , but there is no button to go to , as for binding to my button for the sub.xaml page

<Button x:Name="button" Content="Enter" Height="42" Margin="122,-113,0,0" VerticalAlignment="Top" Width="144" Foreground="#FF50CBC5" Background="#FF0F0E0E" HorizontalAlignment="Left"/> 
+7
visual-studio windows-phone blend
source share
3 answers

The hyperlink button gives you the ability to go to another onclick page.

This screenshot is made from Blend.

enter image description here

So, change your labeling as follows, including the generated Click handler.

 <HyperlinkButton x:Name="button" Click="HyperlinkButton_Click" Content="Enter" Height="42" Margin="122,-113,0,0" VerticalAlignment="Top" Width="144" Foreground="#FF50CBC5" Background="#FF0F0E0E" HorizontalAlignment="Left"/> 

Then in your cs you need to direct the navigation.

 // Button to navigate to sub.xaml page. private void HyperlinkButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Navigate back to sub.xaml page. this.Frame.Navigate(typeof(SubPage)); } 
+10
source share

You will have a Click button for the button. In this click event write code as

 private void Button_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/sub.xaml", UriKind.RelativeOrAbsolute)); } 
+1
source share

You can do this by following these steps.

1st step - add a new button to your window and change the properties as you wish.

The second step is to double-click on this button. then you will go to the cs file as follows.

 private void Button_Click(object sender, RoutedEventArgs e) { } 

The third step is to create a new window object that you want to move and open it, then close the current window

 private void Button_Click(object sender, RoutedEventArgs e) { NewWindow newWindow = new NewWindow(); newWindow.Show(); this.Close(); } 

Thanks.

0
source share

All Articles