Hi Feverbird,
Just use UniformGrid instead, for example:
MainWindow.cs:
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<DockPanel LastChildFill="True">
<Border DockPanel.Dock="Top">
<Button Width="100" Content="Add" Click="Button_Click" />
</Border>
<UniformGrid x:Name="panel" />
</DockPanel>
</Window>
Code Behind:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var image = new BitmapImage(new Uri("Choice_toxicity_icon.png", UriKind.RelativeOrAbsolute));
panel.Children.Add(new Image() { Source = image , Stretch = Stretch.Fill});
}
}
Best Regards,
Shai