Problems with centering for Portrait view and effective width in EB RRS feed

  • Question

  • What does Effective Width mean?  I am trying to center my stackpanel on the screen, and it is way off to the side for some screen sizes and fine for others.  For one screen that is failing, the screen is supposed to be 2560 x 1440 but it says its "effective width" is 1442x800.  Since it is off by 1000, it doesnt display correctly.

    What do I need to do to fix this?

    I just discovered that when I switch in the view between full screen portrait and full screen landscape, the centering does not update.  It always appears as if it were landscape.

    If I just ignore that this is funky, then adding a right margin of 575 makes it work correctly in both blend and the simulator for all window sizes portrait mode for Windows 8. (but throws it off by a large amount in landscape mode) It doesnt make any sense. 
    • Edited by danielsn Thursday, January 10, 2013 7:12 PM
    Thursday, January 10, 2013 6:42 PM

All replies

  • I would say share some code to see how you're trying to display your object because what you're describing is not expected behavior unless you're doing something funky.

    Please mark answers as helpful when used, and answered when completed.

    Thursday, January 10, 2013 8:17 PM
  • The effective resolution has to do with scaling on high pixel density devices. The selection you made in the device pane says "2560x1440" 277 dpi @ 180% scale. That means that everything is scaled up, and the effective resolution is 1422.2 x 800.0 (2560/1.8 by 1440/1.8).

    Couple references about scaling:



    Could you post the xaml you are using and what you want it to do? To center a stackpanel in a grid, you could do this:

     <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        	<StackPanel HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100"/>
    The important part is the HorizontalAlignment and VerticalAlignment.

    Thursday, January 10, 2013 10:44 PM
  •  the page has so much XAML on it that it exceeds the 60,000 character liimit of the "Insert Code" (or is it the message overall)

    Thursday, January 10, 2013 11:35 PM
  • Wow, that is a big page :)

    Not sure if we can help without more information here. Could you post just the relevant parts? Or email me the file at first.last@microsoft.com (using my name)?

    Friday, January 11, 2013 1:59 PM
  • Wow, 60k+ in a single xaml view is huge? I'm going to go out on a limb and think there's probably more going on here than just a funky alignment issue. Otherwise Chuck's example would do the trick just fine. ;)

    Please mark answers as helpful when used, and answered when completed.

    Friday, January 11, 2013 4:49 PM
  • I have been searching through the animations, and dont see anything, but I am not giving up yet.  If I dont find it pretty soon, I will take Chuck up on his offer and send it to him.

    Also, though it wouldnt post when I tried, the file size is not 60K, it is only 52K, so dont know how they got more than 60K characters out of that.

    Friday, January 11, 2013 5:01 PM
  • I would check your layout controls before tinkering in animations.

    Please mark answers as helpful when used, and answered when completed.

    Friday, January 11, 2013 9:42 PM