How do I set the height of my Silverlight UserControl correctly?

I cannot get the silverlight control to exceed 600. Please see the code below to reproduce this behavior. Note that the color bars stop at 600. Can anyone tell me how to get this example to show all the rows in the grid?

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div>
            <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/IT.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
            </div>
    </form>
</body>
</html>

<UserControl xmlns:my1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" x:Class="IT.Test"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="1225">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions >
            <RowDefinition Height="175"/>
            <RowDefinition  Height="175"/>
            <RowDefinition  Height="175"/>
            <RowDefinition  Height="175"/>
            <RowDefinition  Height="175"/>
            <RowDefinition Height="175" />
            <RowDefinition Height="175" />
        </Grid.RowDefinitions>

        <Rectangle Grid.Row="0" Fill="Green"/>
        <Rectangle Grid.Row="1" Fill="Red" />
        <Rectangle Grid.Row="2" Fill="Blue" />
        <Rectangle Grid.Row="3" Fill="Orange"/>
        <Rectangle Grid.Row="4" Fill="Yellow" />
        <Rectangle Grid.Row="5" Fill="Black" />
        <Rectangle Grid.Row="6" Fill="Aqua"/>

    </Grid>

      

+1


source to share


1 answer


I set the background to Grid Gray and all row heights to 50 to see what happens. I think your UserControl is above your browser viewport, but since it is empty no scrollbars are displayed. So I end up with a gray canvas at the bottom that goes all the way to the bottom of this page.



Edit: If you want the UserControl to occupy the entire viewport, remove the Width and Height from the UserControl tag.

0


source







All Articles