Image within a RadioButton
I'm trying to insert an image next to the word in the RadioButton however am struggling as to how I'd do it?
23 Replies
@Midgeesaurus whats the issue? only the alignment?
Ish, If I drag it next to it, it just goes under or above.
I think it makes sense to have horizontal stackpanel around image and radiobutton. In case there are multiple of these you can also put a vertical stackpanel around those if that makes sense
then they should be aligned due to the horizontal stackpanel I think
I may be a total beginner so that may have gone right around my head. sorry 🥲
oh wait I think StackPanel is horizontal by default so you do have it 🤔
mhmm
huh
the "Orientation" is what I'mt alking about
Yeah
I'm still confused to be totally honest.
forget about it
does the radio button change position if you apply verticalAlignment of center? cuz you have that set on the image
but not on the radio button
No the image stays the same. It doesn't go into the box of the text
it seems you can only include image on radio button in wpf by customizing the radio button template. There are a lot of guides online for this
Okay I'll just have a look around. Cheers tho
That command had an error
UnknownCommand: Unknown command.
Remove your reaction to delete this message
$rulesofwpf
Avoid using the designer, because it uses Margin which is the spacing between items.
Using Margin as the primary tool of doing layouts is bad, because it will lead to terrible bugs in the UI.
Thanks for the knowledge.
Always prefer doing layouts with the layout controls, such as Grid, StackPanel, DockPanel, etc.
Still all new too me, I've only been doing it a matter of 3 hours 🙂 I got bored of my xbox ofc and thought of a new hobby to try.
I highly suggest using Hot Reload.
Just start your app (debug), and whenever you save the XAML the app will be redrawn live even when it's running!
currently doesnt give me the option too
If you use Visual Studio, go into options, then debugging and find Hot Reload.
Make sure options there are enabled. If they are and it still isn't working.
Use this link to troubleshoot it. https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/tools-utilities/xaml-hot-reload-troubleshooting?view=vs-2022
tbh with the design ive gone for it looks better without the images.