转自 http://zhxh1012.blog.163.com/blog/static/140866457201191752652161/
绝对 pack WPF URI
1.资源文件 — 本地程序集
Uri uri = new Uri("pack://application:,,,/ResourceFile.xaml", UriKind.Absolute);
子文件夹中的资源文件 — 本地程序集
Uri uri = new Uri("pack://application:,,,/Subfolder/ResourceFile.xaml", UriKind.Absolute);
2.资源文件 — 所引用的程序集
3.所引用的程序集的子文件夹中的资源文件
4.所引用的版本化程序集中的资源文件
WPF URI内容文件
1.Uri uri = new Uri("pack://application:,,,/ContentFile.xaml", UriKind.Absolute);
2.子文件夹中的内容文件Uri uri = new Uri("pack://application:,,,/Subfolder/ContentFile.xaml", UriKind.Absolute);
3.源站点文件Uri uri = new Uri("pack://siteoforigin:,,,/SOOFile.xaml", UriKind.Absolute);
4.子文件夹中的源站点文件Uri uri = new Uri("pack://siteoforigin:,,,/Subfolder/SOOFile.xaml", UriKind.Absolute);
相对 pack URI
1.WPF URI资源文件 — 本地程序集
Uri uri = new Uri("/ResourceFile.xaml", UriKind.Relative);
2.子文件夹中的资源文件 — 本地程序集
Uri uri = new Uri("/Subfolder/ResourceFile.xaml", UriKind.Relative);
Uri uri = new Uri("/ReferencedAssembly;component/ResourceFile.xaml", UriKind.Relative);
Uri uri = new Uri("/ReferencedAssembly;component/Subfolder/ResourceFile.xaml", UriKind.Relative);
Uri uri = new Uri("/ContentFile.xaml", UriKind.Relative);
WPF URI子文件夹中的内容文件Uri uri = new Uri("/Subfolder/ContentFile.xaml", UriKind.Relative);