【发布时间】:2021-09-18 14:58:36
【问题描述】:
我的项目中有以下文件夹结构:
UserControls 文件夹中有“L_Menu.xaml”和“LS_Account.xaml”。这些都是简单的用户控件。
在“L_Menu”用户控件上有一个框架控件,现在是空的,所以属性“Source”仍然是null。
现在我想通过单击事件将框架的源属性设置为“LS_Account”用户控件的 uri。
我使用以下 uri:"pack://application:,,,/src/Content/UserControls/LS_Account.xaml"。
myFrame.Source = new Uri("pack://application:,,,/src/Content/UserControls/LS_Account.xaml", UriKind.Relative);
执行代码时,我收到以下错误消息:
“找不到资源“src/content/usercontrols/src/content/usercontrols/ls_accout.xaml”。”
为什么“新”源附加到“L_Menu”用户控件的源?
【问题讨论】:
标签: c# wpf uri frame uicontrol