I use /{namespace;component/Resources/{filesname}} in xaml
to show in .Net5 Wpf application with below steps:
Dll part:
Create a WPF .NET Application named MyDll
, its target platform is .NET 5
Add a file named Resources
and include a image 969.jpg
in it.
Choose Resource
for Build Action and Copy always
for Copy to Output Directory .
Make it to dll refer to steps in : How to Convert a WPF Windows Application to dll
WPF Project part:
Create a WPF .NET Application named EmbededResourcesImage
, its target platform is .NET 5.
Add MyDll.dll
to its Dependencies
.
Use the image like <Image Source="/MyDll;component/Resources/969.jpg"></Image>
in xaml
Build Action Instructions (Refer to doc)
Resource (WPF only): Embeds the file in a shared (by all files in the assembly with similar setting) assembly manifest resource named AppName.g.resources.
Embedded resource: Embeds the file in an exclusive assembly manifest resource.
If I misunderstand your question, please point out.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.