Problem with Height of Injected View

Dec 9, 2009 at 12:02 AM

I have my first application using Unity, running fairly well.  More I use it, more I like it.  However, I have a problem I don't know how to solve.  My problem is a listview that is being cutoff at the bottom of the region.

The out shell xaml is

<Window x:Class="WebSiteMon.Shell"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cal="http://www.codeplex.com/CompositeWPF"
    xmlns:Controls="clr-namespace:WebSiteMon.Controls"
    xmlns:Infrastructure="clr-namespace:WebSiteMon.Infrastructure;assembly=WebSiteMon.Infrastructure"

    Title="Web Site Monitoring Utility" Height="600" Width="800"  WindowStartupLocation="CenterScreen" Background="{DynamicResource WindowBackgroundBrush}" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*"/>
            <RowDefinition Height="10px" />
            <RowDefinition MaxHeight="250" OverridesDefaultStyle="True" Height="Auto" />
            <RowDefinition Height="10px" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="10px"/>
            <ColumnDefinition />
            <ColumnDefinition Width="10px" />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition Width="10px"/>
        </Grid.ColumnDefinitions>
        <Controls:RoundedBox Grid.Column="1" Grid.ColumnSpan="1" Grid.Row="1" Grid.RowSpan="1"></Controls:RoundedBox>
        <Controls:RoundedBox Grid.Column="3" Grid.ColumnSpan="3" Grid.Row="1" Grid.RowSpan="1"></Controls:RoundedBox>
        <Controls:RoundedBox Grid.Column="1" Grid.ColumnSpan="5" Grid.Row="3" Grid.RowSpan="1"></Controls:RoundedBox>
        <ItemsControl x:Name="MenunRegion"  Margin="0,0,0,7"
                Grid.Column="0" Grid.ColumnSpan="7" Grid.Row="0" Grid.RowSpan="1"
                cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.MENUREGION}"/>
        <ItemsControl x:Name="ActionRegion"  Margin="7"
                Grid.Column="1" Grid.ColumnSpan="1" Grid.Row="1" Grid.RowSpan="1"
                cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.ACTIONREGION}"/>
        <ItemsControl x:Name="ResultsRegion"  Margin="7"
                Grid.Column="3" Grid.ColumnSpan="3" Grid.Row="1" Grid.RowSpan="1"
                cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.RESULTSREGION}"/>
        <ItemsControl x:Name="MainRegion"  Margin="7"
                Grid.Column="1" Grid.ColumnSpan="5" Grid.Row="3" Grid.RowSpan="1"
                cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.LISTREGION}"/>

    </Grid>

</Window>


When I insert a ListView into the LISTREGION, it expands to correct size (at least for 3 items).  My problem is with the RESULTREGION.  A simplified XAML code that is inserted is -
<UserControl x:Class="WebSiteMon.Results.Views.NormalResults"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:CustomNumberFormat="clr-namespace:WebSiteMon.Infrastructure.Converters;assembly=WebSiteMon.Infrastructure"
    >

  <UserControl.Resources>
        <CustomNumberFormat:FormattingConverter x:Key="FormattingConverter"/>
    </UserControl.Resources>
    <Grid>
        <TabControl  >
            <TabItem Header="Raw Data">
                    <ListView Name="RawData" AlternationCount="1" ItemsSource="{Binding}" >
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=ListResults.GetDate}" />
                                <GridViewColumn Header="Time" DisplayMemberBinding="{Binding Path=ListResults.GetTime}" />
                                <GridViewColumn Header="Scan Time" DisplayMemberBinding="{Binding Path=ListResults.ScanTimeSec}" />
                            </GridView>
                        </ListView.View>
                    </ListView>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>

When I add 100+ items to the listview, the view displays like it is in a window that is tall enough to display all the items and
the items outside of the region are clipped. Rather than displaying just the number
that will find in the region with a vertical scroll bar.

tom

Dec 9, 2009 at 5:24 AM

You probably want to ask this over at the Prism forum, not here. Sounds more like a WPF question than a Unity one.