I tried this solution:
<Button>
<StackPanel>
<Image Source="Pictures/img.jpg" />
<TextBlock>Blablabla</TextBlock>
</StackPanel>
</Button>
But I can see the image only in the project window, and when I launch the program it disappears.
If I try this:
Image img = new Image();
img.Source = new BitmapImage(new Uri("foo.png"));
StackPanel stackPnl = new StackPanel();
stackPnl.Orientation = Orientation.Horizontal;
stackPnl.Margin = new Thickness(10);
stackPnl.Children.Add(img);
Button btn = new Button();
btn.Content = stackPnl;
I get a "'System.Windows.Markup.XamlParseException' in PresentationFramework.dll" exception.
What is the solution?