Why does the button size increases as the listbox size gets populated with data?
<p>I'm a newbie to c#. I have designed a windows program with button and listbox. The listbox populates the log as the script runs the application. However, as the listbox gets populated with log, the button and label increases which makes the stack panel very ugly? </p>

<p>Any help/advice would be appreciated. Below is my xaml code.</p>

<pre><code>&lt;Grid&gt;
    &lt;Border BorderBrush="Black" BorderThickness="2" Margin="0,11,0,5" CornerRadius="5" Background="White"&gt;
        &lt;StackPanel Orientation="Horizontal" Margin="7,10,7,2"&gt;
            &lt;StackPanel Orientation="Vertical"&gt;
                &lt;TextBlock Text="City" Margin="5" HorizontalAlignment="Center"&gt;&lt;/TextBlock&gt;
                &lt;ComboBox Name="City" SelectedValue="Chicago" SelectedValuePath="Name"&gt;
                    &lt;ComboBox.ItemTemplate&gt;
                        &lt;DataTemplate&gt;
                            &lt;TextBlock Text="{Binding Path=Name,Mode=OneWay}"&gt;&lt;/TextBlock&gt;
                        &lt;/DataTemplate&gt;
                    &lt;/ComboBox.ItemTemplate&gt;
                &lt;/ComboBox&gt;
            &lt;/StackPanel&gt;
            &lt;Button Name="btnEnter" Content="Enter" Width="200" Margin="4" Padding="6" Click="btnEnter_Click"&gt;&lt;/Button&gt;
            &lt;Button Name="btnViewLog" Content="View Log" Width="100" Margin="4" Padding="6" Click="btnLog_Click"&gt;&lt;/Button&gt;
            &lt;ListBox Name="lbLog"  Visibility="Collapsed"&gt;
                &lt;ListBox.ItemTemplate&gt;
                    &lt;DataTemplate&gt;
                        &lt;TextBox Text="{Binding Description}" IsReadOnly="True"  BorderThickness="0" Background="Transparent"&gt;&lt;/TextBox&gt;
      &lt;/DataTemplate&gt;
                &lt;/ListBox.ItemTemplate&gt;
            &lt;/ListBox&gt;
        &lt;/StackPanel&gt;
</code></pre>

<p>
        
            
                
            
        
    </p>

<p>Thanks.</p>

<p>Ash</p>
