1

快速提问.. 我正在尝试使用 JavaScript 在启动时加载的特定页面上访问 UI 控件。

我的 MainPage 使用 Frame 来显示特定页面。从 App.xaml.cs 我想访问这个特定页面上的 UI 控件。

访问 MainPage 是可行的:

MainPage m = (MainPage)Application.Current.RootVisual;
m.testField.Text = "Working!";

但是如何访问加载到 MainPage.xaml.cs 上的框架中的页面?

亲切的问候,尼尔斯

4

1 回答 1

1

希望这可以帮助..

MainPage page = Application.Current.RootVisual as MainPage;
LoadedPage myPage = page.frame.Content as LoadedPage;
于 2013-11-13T06:14:28.180 回答