First, let me state my intentions. This is the final result I am looking for.
Mockup Of Intent http://s18.postimg.org/x818zbfbb/image.png
The output of my code, however, fails to achieve this. Here's what I did. This is my MainWindow XAML.
<Window x:Class="App.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="" Height="200" Width="400" WindowStartupLocation="CenterScreen" Name="ViewData"> <Grid Name="splMain" Background="{StaticResource GreyGradient}"></Grid> </Window> And this is the C# code for the dynamic RowDefitions creation:
private void ViewImgData(SubPod subPod) { var wb = new WebBrowser(); wb.Navigate(subPod.Image.Src); var rowDefinition = new RowDefinition(); rowDefinition.Height = GridLength.Auto; splMain.RowDefinitions.Add(rowDefinition); Grid.SetRow(wb, 0); ((MainWindow)System.Windows.Application.Current.MainWindow).splMain.Children.Add(wb); } This I am calling from over here. It is guaranteed that this foreach loop would run more than once. However, my output window shows only 1 image instead of 2 or more, that too not taking up the whole space of the Window.
foreach (SubPod subPod in pod.SubPods) { Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action(() => ViewImgData(subPod))); } Where have I mistaken? Thanks.
RowDefinitioneach time but then you put eachWebBrowseralways in the 0 row