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

  • Home
  • SEARCH
  • 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 3226378
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:26:56+00:00 2026-05-17T16:26:56+00:00

Hello there fellow developers! I am working on a Windows Phone 7 app and

  • 0

Hello there fellow developers!
I am working on a Windows Phone 7 app and I can’t figure out what I believe is a simple problem for the more seasoned ones.
Say I have a layout consisting of two elements: a ListBox (filled with an abundance of items) and a TextBlock (providing the user with some basic instructions).

I want these to be one above the other when the device is in Portrait orientation and I want these to be next to each other when the device orientation changes to Landscape.

For the Portrait orientation I am using a Grid layout manager, as it lets me define the rows’ heights like so… row 0 Height="2*", row 1 Height="*"

Listbox sits in row 0, TextBlock in row 1. Now, what would be really neat is to simple change the RowDefinitions into ColumnDefinitions and reassign the listbox/textblock to the grid’s columns instead of rows for when the device switches into Landscape.

But that’s just my idea. I don’t know how to get this done elegantly. Maybe there’s a better approach to this? Or maybe this is the correct approach and there is some method built for exactly this purpose?

Thank you for your suggestions!

  • 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-17T16:26:57+00:00Added an answer on May 17, 2026 at 4:26 pm

    How about this for the default portrait configuration:-

    <Grid>
       <Grid.RowDefinitions>
           <RowDefinition Height="2*" />
           <RowDefinition Height="*" />
       </Grid.RowDefintions>
       <Grid.ColumnDefinitions>
           <ColumnDefinition Width="2*" />
           <ColumnDefinition Width="*" />
       </Grid.ColumnDefinitions>
    
       <ListBox x:Name="ItemList" Grid.ColumnSpan="2" />
       <TextBlock x:Name="Instructions" Grid.Row="1" Grid.ColumnSpan="2">
          Content
       </TextBlock> 
    

    Then in your OrientationChanged event use:-

    if ((e.Orientation & PageOrientation.Portrait) == PageOrientation.Portrait)
    {
         Grid.SetRow(ItemList, 0);
         Grid.SetRowSpan(ItemList, 1);
         Grid.SetColumn(ItemList, 0);
         Grid.SetColumnSpan(ItemList, 2);
    
         Grid.SetRow(Instructions, 1);
         Grid.SetRowSpan(Instructions, 1);
         Grid.SetColumn(Instructions, 0);
         Grid.SetColumnSpan(Instructions, 2);
    }
    else
    {
         Grid.SetRow(ItemList, 0);
         Grid.SetRowSpan(ItemList, 2);
         Grid.SetColumn(ItemList, 0);
         Grid.SetColumnSpan(ItemList, 1);
    
         Grid.SetRow(Instructions, 0);
         Grid.SetRowSpan(Instructions, 2);
         Grid.SetColumn(Instructions, 1);
         Grid.SetColumnSpan(Instructions, 1);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello Again my fellow programmers out there, I'm designing and programming from scratch a
Hello fellow Grails Developers! I was wondering if you could help me with what
Hello fellow software developers. I want to distribute a C program which is scriptable
Hello there fellow Stackers! I wonder if anybody could tell me what the following
Hello there and Merry Christmas !!! I am new to WPF and I am
Is there the equivalent of the Hello World program for GIS applications? I am
Hullo all, Wondering if there are any Java hackers who can clue me in
Hello can anybody solve this please I'm creating the object in the action class
Hello , I am currently working on the student association's website. The student's association
Hello my fellow stackoverflower, i'm looking for away to smooth an image of and

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.