✅ WPF XAML Designer
Hello, my xaml designer do not work but i can't figure it out why.
There is an exception which say it's not able to find the resource " 'resources/images/png/manual/[email protected]'" but this resource isn't use in my page, this resource is used in the UC which is in this page.
the fact is that my xaml designer work well for the UC but when i add this UC to the page, the xaml designer of the page trigger an exception.
The app have no problem when i run it i just want to know why the xaml designer trigged and exception
34 Replies
Do not use the designer
$rulesofwpf
Margin is the spacing between elements, it is not absolute position or relative
So if you resize the app, UI will mess up immediately.
thanks but how i am supposed to add a space of 5 between each element without using margin ?
You must use layout controls.
i will keep this seems to be really useful 😮
And Margin is fine if it's below 30.
✅ Use layout controls (Grid, DockPanel, etc) to support proper resizingAlso you have hot reload, which means you can just run the app and change the XAML, and the running app will change immediately upon file save.
i already knew that i use it everytime ahah
ok so i'll keep it in mind that xaml designer sucks
But regarding the image not being found, is it marked as a resource?
yup everything work but when i had the usercontrol to my page it says that the resource isn't find and i don't know why the page try to find it if it's in the usercontrol
Have you tried renaming it to something that doesn't contain special characters?
Something common like
Material1.png
no i didn't tried cause my UC didn't trigger any exception and the image was well displayed but i'll try
same error impossible to find the resource
Wait, how do you load it?
and where
Please show the XAML
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/replace cs with xml (easier to read)
BlazeBin - bmhufnfyxvbl
A tool for sharing your source code with the world!
what i've called page is the one containing the UC which trigger the exception
Is it an image component?
the UC which is the problem is MaterialDetailsView
my button style
nop i just add an image in the background of a button
Tag?
i found this solution to set an image in the background of the button i don't know what's really tag 😅
here is how i use the button
I would just set the Content directly rather than to use Tag
in the content ?
Tag is a boxed value of type
object
<Button Style="{StaticResource CircularImageButtonStyle}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="10,140,0,0">
<Image x:Name="image" Source="{StaticResource MaterialType}" />
</Button>
like this ?
Sure
ok it simplier than what i was trying to do 😂
i will try this to see if it resolve my problem
ok that's better thanks i will keep this then
and i won't forget to save this to not forget it 🙂
thanks !
Anytime.
Good luck.