Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在与主项目不同的库中使用资源映像_C#_Wpf_Image_Resources_.net Assembly - Fatal编程技术网

C# 在与主项目不同的库中使用资源映像

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

我有一个WPF程序,有两个库

现在,我在主程序和HelperLib中都有一个灰色的资源背景。但是另外,在HelperLib中,我有一个我想要使用的红色背景

现在,当我想用以下内容更改窗口的背景时:

 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")