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 6379751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:10:41+00:00 2026-05-25T02:10:41+00:00

I am looking to do something with XAML so that the row heights within

  • 0

I am looking to do something with XAML so that the row heights within a grid are variable. But I am not sure if it is possible.

I have two rows in a grid, and if there is data to fill each row then no issue. But, if there is no data to fill the second row then I would like the data in the fist row to be in fact centered using both rows.

I can achieve this by using the Rowspan property, but can I make this dynamic, based upon whether there is data for the row or not?

If not is there any other way for me to achieve this?

Updated code follows.

<StackPanel Grid.Row="0" Grid.Column="4" Grid.RowSpan="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40"/>
                        <RowDefinition Height="25"/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="{Binding Details}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextNormalStyle}" 
                       Grid.Row="0"  Grid.Column="0" Grid.RowSpan="{Binding DetailRowSpan}"  FontSize="{StaticResource PhoneFontSizeMediumLarge}" VerticalAlignment="Center" />

                    <TextBlock Text="{Binding Location}" Style="{StaticResource PhoneTextSmallStyle}"
                       Grid.Row="1" Grid.Column="0"/>

                </Grid>

            </StackPanel>
  • thanks
  • 1 1 Answer
  • 0 Views
  • 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-25T02:10:42+00:00Added an answer on May 25, 2026 at 2:10 am

    Set the Height property of the first row to *, and the height property of the second row to Auto:

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

    This will make the height of the second row 0 if there is nothing in it. The first row will take up any available space.

    EDIT: After re-reading your question and reading the comments, I think that what you are actually asking is how to dynamically make a single cell span multiple rows (or not), depending on whether the next grid has content for that column. If that is the case, then I’d recommend creating a read-only integer property in the class that is bound to the cell whose height might vary. The property should calculate the number of rows that the cell should cover by examining the adjacent rows. It can then be bound to the RowSpan property of the grid.

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

Sidebar

Related Questions

I'm looking for something that will show me the size of each folder within
I'm looking for something that will monitor Windows directories for size and file count
I'm looking for something like paint.net or Gimp, but for audio files, and runs
I have a table structure looking something like this. One outer table and in
I may be over looking something but is there a simple way in C++
I'd like to be able to have some sort of volume panel looking something
Can someone recommend a simple c# code generator. I just looking something with methods
Looking for something like: $(input:radio:checked).previous(name, original_name).attr(name,new_name); I tried a few different seen around here
Looking for something similar to xerces for parsing an xml file in ruby. I
I was looking for something like Server.MapPath in the ASP.NET realm to convert the

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.