怎么在一个页面里调用Mainwindow的frame控件

我想在一个页面Page中点击一个按钮来跳转frame

页面是通过Frame嵌入的

就是在Page页面调用主页面Mainwindow的frame控件好

ide:vs2019 语言:wpf C

球球各位大佬~~

我是小白,望直接贴代码

frame命名:Frame1 页面命名:Page3

https://blog.csdn.net/weixin_33812433/article/details/85356220

private Dictionary allViews = new Dictionary(); //包含所有页面
allViews.Add("Page3", new Uri("myPage/Page3.xaml(页面地址)", UriKind.Relative));
mainFrame.Navigate(allViews["Page3"]);//Frame类的导航函数,参数时页面的Uri
图片说明图片说明

图片说明