Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:37+00:00 2026-05-16T23:47:37+00:00

I have the following grid as the LayoutRoot control in my Silverlight page: <Grid.RowDefinitions>

  • 0

I have the following grid as the LayoutRoot control in my Silverlight page:

    <Grid.RowDefinitions>
        <RowDefinition Height="30"/>
        <RowDefinition Height="*" />
        <RowDefinition Height="30" />
    </Grid.RowDefinitions>

The entire contents of the second row is a datagrid populated via data binding, and the total height of the grid is large, maybe 3000 pixels. My understanding is that by doing the row definitions in this way, the first and third rows should have the same height and always remain visible (like header and footer rows) while the second row should be sized to the total height minus 60 for the other rows. But what actually happens is that the second row is taking up the full 3000 pixels, not showing a vertical scroll bar, and pushing the footer row past the bottom of the control. This is what Height=”Auto” should do, I think, NOT what Height=”*” should do.

What am I missing here? Thanks!

Update: The problem turned out to be that my grid was in a navigation page which was embedded in a main page, because I accepted the default Silverlight project template. This main page was laid out to allow expanding to content, by putting everything in a StackPanel. It doesn’t appear that you actually need to set the Horiontal and Vertical alignment properties to Stretch. When I replaced the StackPanel with a grid, and set the inner grid row height to *, it worked as intended.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:47:38+00:00Added an answer on May 16, 2026 at 11:47 pm

    The default behaviour of a topmost grid is to resize to fit content, unless forced to do otherwise.

    You need to add VerticalAlignment=”Stretch” HorizontalAlignment=”Stretch” to your grid itself. That will make it stretch to fit the Silverlight Component dimensions (e.g. 100% of browser).

    The basic calculation of rows and columns goes like this:

    1. Subtract any fixed size rows/columns
    2. Work out and subtract any autosize rows/columns based on content.
    3. Divide the remainder proportionally*

    *Note: If the grid itself is not constrained the height and width expand to fit the content (like auto).

    The way nested containers operate is one of the most confusing things to get right in Silverlight, but once you get all the gotchas it will make perfect sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my XAML: <Grid x:Name=LayoutRoot Background=White> <Grid.RowDefinitions> <RowDefinition Height=20/> <RowDefinition
I have the following sample from MSDN: <Grid x:Name=LayoutRoot Background=White> <Grid.RowDefinitions> <RowDefinition Height=25 />
I have the following grid <Grid> <Grid.RowDefinitions> <RowDefinition Height=Auto /> <RowDefinition Height=Auto /> <RowDefinition
I have the following grid: <Grid> <Grid.RowDefinitions> <RowDefinition Height=Auto/> <RowDefinition/> <RowDefinition Height=Auto/> </Grid.RowDefinitions> ...
I have the following grid: <Grid> <Grid.RowDefinitions> <RowDefinition Height=Auto/> <RowDefinition Height=Auto/> <RowDefinition Height=*/> <RowDefinition
I have the following XAML on my page: <Grid x:Name=LayoutRoot> <Viewbox Stretch=Uniform> <Image x:Name=myImage
I have a simple user control with the following content: <Grid x:Name=LayoutRoot> <Button x:Name=btnOpenGenericPage
I have following layout <Grid x:Name=LayoutRoot Background=Transparent> <Grid Height=100 Background=Wheat Opacity=0.4> <StackPanel Orientation=Vertical VerticalAlignment=Bottom>
I have following user control: <UserControl.Resources> <Style TargetType=HeaderedItemsControl> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=HeaderedItemsControl> <Grid>
I have defined following control template for my custom control. <ControlTemplate TargetType={x:Type local:CustomControl}> <Grid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.