I have been looking online for hours trying to find a way to insert a simple image into my Universal Windows Application. All the tutorials I have found so far have been too confusing or just don't work.
Is there a way to insert an image into my XAML page that can be explained for someone new to developing Windows Apps? Do I need to initialize it in XAML and C#, or just through XAML?
I had the same problem, where I only needed to just add simple picture get it over with, I'm assuming that you are using VS2017 if no, then I don't know if this solution will work, but if you are using VS2017 then do the following
fist add an image element for example <Image x:Name="img1" Width="100" Height="100" />
in the Universal Apps, there is a folder called Assets
you will find it in the solution folder, also in the solution explorer,
right click on it in the solution explorer -> add existing item -> the photo you want
after you have added the photo, go to the img1
prosperities and in the source you will find the photo that was added inside the drop down list, keep in mind that there is already images in the assets
you will find that the path for the image is added automatically in the Source
attribute to the control img1
for example <Image x:Name="img1" Width="100" Height="100" Source="Assets/1.jpg" />
Remember that when you want to insert a new image into Assets, you must go into the solution explorer, Assets->Add->New Item. If you insert the image manually, then you need to Add->existing item. Then select the image, rigth click, properties and in Build Action, make sure "content" is the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With