我的XAML设计人员不断尖叫“找不到资源xxx.xaml”。我已经尝试过打包应用程序和绝对路径URI格式
"pack://application:,,,/ReferencedAssembly;component/Subfolder/ResourceFile.xaml"
"pack://application:,,,/Subfolder/ContentFile.xaml"
"/AssemblyName;component/FilePath.xaml"
项目文件结构(无法发布图片,没有足够的代表):
root/App.xaml
root/MainWindow.xaml
root/Res
root/Res/PalleteBlue.xaml
root/UserControl
root/UserControl/NavigationDrawer.xaml
root/UserControl/Res
root/UserControl/Res/NavigationDrawerResource.xaml
NavigationDrawer.xaml
使用NavigationDrawerResource.xaml
MainWindow.xaml
的实例为NavigationDrawer.xaml
NavigationDrawer
上的XAML设计器没有问题,但是在MainWindow
上,它不断告诉Cannot locate resource usercontrol/res/navigationdrawerresource.xaml
这是NavigationDrawer.xaml
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/UserControl/Res/NavigationDrawerResource.xaml"/>
<ResourceDictionary Source="pack://application:,,,/Res/PalleteBlue.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
这是MainWindow.xaml
如何添加NavigationDrawer
的实例
xmlns:uc="clr-namespace:InfiniteLite.View.UserControl"
<Grid>
<uc:NavigationDrawer></uc:NavigationDrawer>
</Grid>
这会在Cannot locate resource....
标签上产生<uc:NavigationDrawer>
错误,但项目可以很好地调试