WPF 后台使用资源图片(WPF background resource picture)

一般使用:

 Img.Image = new BitmapImage(new Uri("/Resources/列表循环_白.png", UriKind.Relative));

找不到时,使用:

 Img.ImageSource = new BitmapImage(new Uri("pack://application:,,,/MovieDesktop;component/Resources/列表循环_白.png", UriKind.Absolute));

注意把Resources中的资源图片设置为始终复制-资源;

————————

General use:

 Img.Image = new BitmapImage(new Uri("/Resources/列表循环_白.png", UriKind.Relative));

If not found, use:

 Img.ImageSource = new BitmapImage(new Uri("pack://application:,,,/MovieDesktop;component/Resources/列表循环_白.png", UriKind.Absolute));

Note that the resource picture in resources is set to always copy – resources;