【发布时间】:2015-04-22 15:57:28
【问题描述】:
我有两个页面和一个主窗口..我在两个框架中加载页面..现在我想执行彼此的方法..我该怎么做?
这是 Page1.cs:
public partial class Page1 : Page
{
public Method1()
{
doSomething;
}
}
这是 Page2.cs:
public partial class Page2 : Page
{
public Method2()
{
doSomethingElse;
}
}
在我的 MainWindow 中会发生以下情况:
Frame1.Source = new Uri("/Source/Pages/Page1.xaml", UriKind.RelativeOrAbsolute);
Frame2.Source = new Uri("/Source/Pages/Page2.xaml", UriKind.RelativeOrAbsolute);
有什么办法,从Page1.cs执行Method2,从Page2.cs执行Method1?
问候
【问题讨论】:
标签: c# wpf frames communicate