C
C#5mo ago
Kamvurus

Trying to create an Image in Visual Studio 2022

I wrote this code to create an image (technically I created the image by using the Toolbox's XAML Controls) And I added the source tag and directed it to assets. But for some reason it doesn't render the image, as its just invisible. I also cant move the image element anymore.
No description
12 Replies
Kamvurus
KamvurusOP5mo ago
Any reason why?
Impix
Impix5mo ago
<Image x:Name="image" Source="/Assets/numbL-Logo.png" Width="300" Height="200" />
leowest
leowest5mo ago
yes because u drag and drop the controls $rulesofwpf
MODiX
MODiX5mo ago
Rules of WPF:

❌ Avoid the WPF Designer to eliminate a category of confusing bugs
❌ Don't rely on Margin as the primary tool for layouts
❌ Avoid writing UserControls or subclassing to extend a default control -- use Behaviors instead (Microsoft.Xaml.Behaviors.Wpf)

✅ Write XAML by hand and autoformat with "Ctrl K,D" or XAML Styler
✅ Rely upon XAML Hot Reload to design your app's UI at runtime
✅ Use layout controls (Grid, DockPanel, etc) to support proper resizing
✅ Use data binding to eliminate glue code and state synchronization issues
✅ Use collection controls and DataTemplate to dynamically create lists of controls
✅ Learn MVVM to create maintainable apps
✅ Use the Dispatcher to update controls from non-UI threads
✅ WPF's default controls can be easily modernized via $wpfuilibs
✅ Include relevant XAML, code-behind, and ViewModel code for questions when possible
Rules of WPF:

❌ Avoid the WPF Designer to eliminate a category of confusing bugs
❌ Don't rely on Margin as the primary tool for layouts
❌ Avoid writing UserControls or subclassing to extend a default control -- use Behaviors instead (Microsoft.Xaml.Behaviors.Wpf)

✅ Write XAML by hand and autoformat with "Ctrl K,D" or XAML Styler
✅ Rely upon XAML Hot Reload to design your app's UI at runtime
✅ Use layout controls (Grid, DockPanel, etc) to support proper resizing
✅ Use data binding to eliminate glue code and state synchronization issues
✅ Use collection controls and DataTemplate to dynamically create lists of controls
✅ Learn MVVM to create maintainable apps
✅ Use the Dispatcher to update controls from non-UI threads
✅ WPF's default controls can be easily modernized via $wpfuilibs
✅ Include relevant XAML, code-behind, and ViewModel code for questions when possible
leowest
leowest5mo ago
by drag and dropping controls u produce margins that can render your element off screen margins are not supposed to be use to position items on screen but just adjust them slightly
leowest
leowest5mo ago
No description
Kamvurus
KamvurusOP5mo ago
didnt work i cant see the image even when i dont use margins
leowest
leowest5mo ago
$paste your XAML to the below site so I can take a look
MODiX
MODiX5mo ago
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
leowest
leowest5mo ago
and to make sure is this WPF? or something else
Kamvurus
KamvurusOP5mo ago
is UWP
leowest
leowest5mo ago
No description

Did you find this page helpful?