design issue, stretching a usercontrol in a region

Topics: Prism v2 - Silverlight 3
Apr 28, 2010 at 10:09 AM

This is maybe not really a composite ui question, but more a general 'designing with silverlight' question. Though it is related to what I try to accomplish in a region.

My ShellView has a grid, 3 rows, 3 columns. row 0 and 2, column 0 and 2 are all fixed 100 pixels. So only the center cell should be resizing with the sizing of the browser. That seems to be the case.

In this center cell I have an Itemscontrol:

        <ItemsControl cal:RegionManager.RegionName="MainRegion" Grid.Row="1" Grid.Column="1" Margin="5" Background="#FFDA2626"/>

And I have this very simple view that is inserted in the mainregion, Its only a colored layoutroot.

<UserControl x:Class="Differ.Modules.Locations.Views.LocationsView"
 d:DesignWidth="640" d:DesignHeight="480" Background="#FFE41D1D" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

 <Grid x:Name="LayoutRoot" Background="#FFD6CE16"/>

The problem: I dont get to see the usercontrol in the region, its there allright but it's not stretched to fill the whole cell. I know it;s there because if I give it a fixed size I can see it.

It is not clear to me who is responsible for getting the usercontrol streched, the usercontrol or the container?






Apr 30, 2010 at 8:23 PM

Hi Ben,

The issue you are experiencing is probably because of the way WPF handles properties, so it depends on the exact controls and layout you are using. As it is not related to Prism, you could remove the region and place the UserControl in the center cell for more ease in testing why the UserControl doesn’t stretch.

You will probably find more adequate feedback in the Silverlight forums or WPF forums. Maybe you can find this post useful.

I hope you find this helpful.

Guido Leandro Maliandi