Listbox extending off the page

I have a listbox inside of a stack panel inside of a border in a silverlight application and when ever I add anything to the listbox it increases in height so the scrollbar is never used and it extends beyond the boundaries of the border element. I have tried explicitly setting the height attribute of the listbox, the border and the stack panel and it still goes beyond this.

Here is my code:

<Border x:Name="articlePane">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">
                        <Button Content="Latest" MouseEnter="HandleRollInAnimation" MouseLeave="HandleRollOutAnimation" />
                        <Button Content="Pending" MouseEnter="HandleRollInAnimation" MouseLeave="HandleRollOutAnimation" />
                        <Button Content="Done" MouseEnter="HandleRollInAnimation" MouseLeave="HandleRollOutAnimation" />
                    <ListBox x:Name="articleList" Margin="5" Background="Transparent" ItemsSource="{Binding}" 
                                <StackPanel Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Center">
                                    <Image x:Name="articleImage" />
                                    <TextBlock x:Name="articleTitle" Text="{Binding Path=Title}" FontSize="18" FontWeight="Bold"
                                    <TextBlock x:Name="articleDate" Text="{Binding Path=Date}" FontSize="14" Foreground="Gray"


I have a feeling that the StackPanel just keeps on adding height forever. I think in this instance you'd be better off with a Grid layout within your Border. Put the Button StackPanel in one height defined row, and the ListBox in an autosizing * height row. This way Grid will stick within the confines of your form.

Need Your Help

Detect an internet connection activation with Delphi

delphi winapi wininet internet-connection

I've been using a 3G wireless card for a while and every time I connect, my anti-virus fires up the updates.

what datasource to use intead of jboss one's?

oracle jboss datasource connection-pooling

we are removing jboss from spring-based application and considering what a datasource to use instead of jboss's one for oracle. We used such properties (in oracle-ds.xml) as

Directive to create a button

javascript angularjs

I got help to save json as file in client side here. Code is very short as in this fiddle.