0

I tried to set up a Icon in XAML from the Resources.resx but it cant find the resources.

Code:

....
xmlns:resx="clr-namespace:Admin_Overwatch.Properties"
Title="MainWindow" Height="400" Width="600" Icon="{x:Static
resx:Resources.TitelLogomRand1}">

Error: "The name "Resources" doesen´t exist in the namespace...."

The courious thing is that in the autoformat it finds every icon in the Resources file. I have Rebuild it without any success and tried a new Resource folder also with no success.

Why doesn´t it find the Folder(s) ?

Edit: I tried this tutorial also without any success, I got the same error, it can´t find the resources.... http://social.technet.microsoft.com/wiki/contents/articles/22420.binding-to-resources-resx-files-in-xaml.aspx

FoldFence
  • 2,674
  • 4
  • 33
  • 57

2 Answers2

0

The Answer was to use the Assembly in addition to the normal clr:

xmlns:resx="clr-namespace:Admin_Overwatch.Properties;assembly=Admin-Overwatch"
xmlns:local="clr-namespace:Admin_Overwatch;assembly=Admin-Overwatch"

The Assembly name can be found by Right Click on the Project name under Properties --> Application.

But the important part is that it is not possible to load the pictures from the resx in wpf that goes only in win forms.

see here: How to use Resources.resx to link images

Community
  • 1
  • 1
FoldFence
  • 2,674
  • 4
  • 33
  • 57
0

I had simmilar problem. Added a placeholder image to use as default ImageSource in XAML on startup. I created it trough Project+Right-Click->Properties>Resources>Add Resource>New Image etc. Then got to Resource folder in the project, selected the image and down bellow in properties I just selected Build Action to Resource. And now it works!

luskos
  • 1