ItemsControl with Vertical Stretching in Silverlight

Topics: Prism v2 - Silverlight 2, Prism v2 - Silverlight 3
Nov 24, 2009 at 2:01 PM

I have a relatively simple Shell layout that I cannot get to properly work in Silverlight 3.  I have 3 regions on the shell.  The left most region needs to be an ItemsControl so I can dynamically inject 2 user controls.  Sometimes the region will have 1 user control.  Sometimes 2, max.  If its 1, I'd want that control to vertically stretch the whole height.  If 2, then I'd like it to just equally share the height.  Here is xaml for the region.

<!-- Define navigation container -->
            <ItemsControl x:Name="NavigationContainer" Grid.Row="0" Grid.Column="0"
                      VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">           
                    <ItemsPanelTemplate >
                        <toolKit:DockPanel  />

Currently, this stacks them horizontally, side by side.  If I replace the <DockPanel> with a <Grid/> it stacks them such that the first control is hidden.

The Views being injected in currently don't have any height or width properties being set.

I found this post but it is specific to WPF since Silverlight ItemsControl doesn't seem to have ItemContainerStyle. 

Can anyone help me?