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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:38:53+00:00 2026-06-14T07:38:53+00:00

The following is a very basic layout for a Windows Phone 8 app. I’ve

  • 0

The following is a very basic layout for a Windows Phone 8 app. I’ve got a PivotControl with a PivotItem. The header of the PivotControl is outlined in red, while the PivotItem is outlined in green. I’m going to have a Canvas taking up 100% of the PivotItem so I need to be able to calculate it’s dimensions accordingly (because that height/width will determine the size and placement of other controls).

So right now I can calculate the width of my PivotItem with this, where margin is the amount of margin on all four sides (multiplied by 2 for the left and right):

double width = Application.Current.Host.Content.ActualWidth - (margin * 2);

The height is more difficult because I need to take the total screen height and subtract the StatusBar height, and the header height (red rectangle in my image).

Does anyone know how I can get the height of my PivotItem? Is there an easier way than trying to calculate it like I am? Right now the Height and ActualHeight properties are both 0.0.

enter image description here

  • 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-06-14T07:38:54+00:00Added an answer on June 14, 2026 at 7:38 am

    If I understand correctly, you have a Canvas occupying the whole PivotItem? Something like this:

    <phone:Pivot>
        <phone:Pivot.Items>
            <phone:PivotItem Header="menu">
                <Canvas x:Name="Canvas" />
            </phone:PivotItem>
            <phone:PivotItem Header="game" />
        </phone:Pivot.Items>
    </phone:Pivot>
    

    If so, retrieving the height of the canvas is quite straightforward:

    Debug.WriteLine(this.Canvas.ActualHeight);
    

    Note: the ActualHeight property won’t be populated before the Loaded event. So if you’re trying to read it from the constructor or the OnNavigatedTo method, the property will be equal to 0.

    The full XAML code:

    <phone:PhoneApplicationPage 
        x:Class="WP7ForumTest.Page3"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
        xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        FontFamily="{StaticResource PhoneFontFamilyNormal}"
        FontSize="{StaticResource PhoneFontSizeNormal}"
        Foreground="{StaticResource PhoneForegroundBrush}"
        SupportedOrientations="Portrait" Orientation="Portrait"
        Loaded="Page_Loaded">
    
        <!--LayoutRoot is the root grid where all page content is placed-->
        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
    
            <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
                <phone:Pivot>
                    <phone:Pivot.Items>
                        <phone:PivotItem Header="menu">
                            <Canvas x:Name="Canvas" />
                        </phone:PivotItem>
                        <phone:PivotItem Header="game" />
                    </phone:Pivot.Items>
                </phone:Pivot>
            </Grid>
    
    </phone:PhoneApplicationPage>
    

    And the code-behind:

    private void Page_Loaded(object sender, RoutedEventArgs e)
    {
        MessageBox.Show(this.Canvas.ActualHeight.ToString());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following very basic template: <html> <head> </head> <body> <div> <!-- Using
Very very basic question but I've got the following HTML: <input type=text id=nspcc value=0
I've got a very basic application that boils down to the following code: char*
I have the following very basic layout for each row of a ListView .
Very basic django app that gives me the following when I try to do
I have a very basic iphone app where the following steps occur. App Delegate
Probably a very basic beginner question. Imagine the following situation: I have an ASP.NET
This is a very basic question, so please bear with me. Consider the following
I have got the following very simple code: function init() { var articleTabs =
Consider the following very basic WCF service implementation: public enum TransactionStatus { Success =

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.