Adding an Image inside a Button programmatically
Button
is a Content
control so you just have to use the Buttons
Content
property
Example:
Button myButton = new Button{ Width = 24, Height = 24, Content = new Image { Source = new BitmapImage(new Uri("image source")), VerticalAlignment = VerticalAlignment.Center }};
Why don't you add the Image in XAML and bind Source
to a property in your view model?