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"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 mc:Ignorable="d"
 d:DesignWidth="640" d:DesignHeight="480" Background="#FFE41D1D" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

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

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?

Thanks

  Ben

 

 

 

Developer
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
http://blogs.southworks.net/gmaliandi