为需要跨页面访问的控件于XAML添加下列代码:
x:FieldModifier=" Public" <Frame x:FieldModifier=" Public" x:name="primaryFrame"/>
public sealed partial class MainPage : Page { public static MainPage firstPage; public MainPage() { this.InitializeComponent(); firstPage= this; } }
其他页面引用代码:
MainPage.firstPage.primaryFrame