2
votes

In my on going quest to learn C#, both winforms and WPF, I have whipped up a program similar to visio in WPF. Its using the new WPF ribbon control, and am using a expander to hold some basic shapes that can be made in Xaml(ie. Ellipse), and the shapes are stored in a 'shapebox' that the shapes can later be dragged onto the form and manipulated from there.

None of the current shapes are from images, which is my next goal. What Im looking to do is load the images via XAML and add them to this shapebox just the same. The shapebox is a custom class.

My question is this: How would I go about loading images from file using only xaml?

2

2 Answers

3
votes

I found the information I was after.

Simply loading an image using xaml is:

<Image Source="/blah/image.png" />

This works for Images included, not external. To load external images Im not sure.

0
votes

You should read msdn articles they provide complete set of solutions for every problem. Still, I can give you quick link to solve your problem, you can add both through XAML or ViewModel(if you follow MVVM). Try this link: Adding Images and Icons

still if you dont get any help, please revert back.