C# 在与主项目不同的库中使用资源映像
我有一个WPF程序,有两个库 现在,我在主程序和HelperLib中都有一个灰色的资源背景。但是另外,在HelperLib中,我有一个我想要使用的红色背景 现在,当我想用以下内容更改窗口的背景时:C# 在与主项目不同的库中使用资源映像,c#,wpf,image,resources,.net-assembly,C#,Wpf,Image,Resources,.net Assembly,我有一个WPF程序,有两个库 现在,我在主程序和HelperLib中都有一个灰色的资源背景。但是另外,在HelperLib中,我有一个我想要使用的红色背景 现在,当我想用以下内容更改窗口的背景时: switch (bubbleType) { case eBubbleType.ERROR: bw.btText.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Reso
switch (bubbleType)
{
case eBubbleType.ERROR:
bw.btText.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Images/gradientWallpaper_RED.jpg"))); <-----I want to use this one
break;
default:
bw.btText.Background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/Resources/Images/gradientWallpaper.jpg")));
break;
}
开关(气泡类型)
{
case eBubbleType.ERROR:
bw.btText.Background=新的图像笔刷(新的位图图像(新的Uri)(“pack://application:,,,/Resources/Images/gradientWallpaper_RED.jpg”);您必须使用带有引用程序集名称的:
new Uri(
"pack://application:,,,/HelperLib;component/Resources/Images/gradientWallpaper_RED.jpg")