C
C#2mo ago
Kam_

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
Kam_
Kam_OP2mo ago
Any reason why?
Impix
Impix2mo ago
<Image x:Name="image" Source="/Assets/numbL-Logo.png" Width="300" Height="200" />
leowest
leowest2mo ago
yes because u drag and drop the controls $rulesofwpf
MODiX
MODiX2mo 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
leowest2mo 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
leowest2mo ago
No description
Kam_
Kam_OP2mo ago
didnt work i cant see the image even when i dont use margins
leowest
leowest2mo ago
$paste your XAML to the below site so I can take a look
MODiX
MODiX2mo 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
leowest2mo ago
and to make sure is this WPF? or something else
Kam_
Kam_OP2mo ago
is UWP
leowest
leowest2mo ago
No description
Want results from more Discord servers?
Add your server