I have a WPF project. If I store image in {ProjectRoot}\Images\image.png, and compile it as Resource then I can access it from a xaml (this xaml is located at Root) as BitmapImage by BitmapImage UriSource="Images/image.png"
. But if I move the xaml to another folder, say {ProjectRoot}\Xamls, now I have to use BitmapImage UriSource="../Images/image.png"
. Is there a way to specify an absolute project path, so that I can refer to them with the same path regardless of the location of the xaml?
相关问题
- Generic Generics in Managed C++
- VNC control for WPF application
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
相关文章
- .net中MessageBox.Show使用问题
- IdentityServer 报错:"idp claim is missing"
- 在 IdentityServer 中如何给 id token 添加更多信息
- WPF:如何在Trigger里修改Orientation?
- IdentityServer 的 Selector 在哪个 nuget 包
- 使用 IdentityServer 的项目遭遇错误:"IDX20803: Unable to obt
- ASP.NET Core ConfigureServices 中从 appsettings.json
- WPF aforge 怎么做一个 圆形的播放器
Take a look at Pack URIs in WPF
You can use this syntax both to reference by an absolute path inside the same project, or reference files in other projects:
Here "MyAssemblyName" is the project/dll/exe name and "component" indicates the project root.