一个带有按钮的stackpanel页面的框架导航。
XAML代码示例:
C#代码示例:
private void NavigateToPageWithButton_Click(object sender, RoutedEventArgs e) { MyFrame.Navigate(typeof(PageWithButtonInStackPanel)); }
public class PageWithButtonInStackPanel : Page { public PageWithButtonInStackPanel() { StackPanel stackPanel = new StackPanel(); Button button = new Button(); button.Content = "Click me!"; stackPanel.Children.Add(button); this.Content = stackPanel; } }