0

I created a new UWP app (target version 10.0 build 14393; min. version 10.0 build 10586) in vs. I then changed the xaml for the main page to add two text boxes. As you can see from the image below, this resulted in the bottom textbox being partly obscured by the phone emulator's taskbar.

My intuition says that the sensible thing to do would be to size the app such that its content window does not intersect with the taskbar. How can I do that?

I'm not real familiar with Windows Phone and am open to other suggestions.

<Page
    x:Class="HelloWorld.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HelloWorld"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <TextBox Text="Hello"></TextBox>
    <TextBox Text="World" FontSize="30" VerticalAlignment="Bottom"></TextBox>
    </Grid>
</Page>

Here is the result in the phone emulator: (Mobile emulator 10.0.14393.0 WVGA 4 inch 512MB)

enter image description here

William Jockusch
  • 26,513
  • 49
  • 182
  • 323
  • The Grid puts them in front of each other. You are only seeing both because of the FontSize="30". Study some sensible layout examples first. – H H Jan 08 '17 at 14:10
  • Yes, I made the font big so it would be clear that the "world" exists. I took a look at Microsoft's samples; they look fine, but the xaml is hundreds of lines long, so I don't know what part is relevant. – William Jockusch Jan 08 '17 at 14:35
  • Plenty of tutorials about Grid, RelativeGrid and StackPanel. Not a good basis for an SO question. – H H Jan 08 '17 at 14:46
  • . . . none of which is the slightest help if I don't know the size/position of the TaskBar, or of the screen minus the TaskBar, or any reference to it. And apparently that information is unavailable. http://stackoverflow.com/questions/33898342/uwp-how-to-get-the-taskbar-height – William Jockusch Jan 08 '17 at 14:57
  • That might make a good question. I think I've seen this on an emulator once but it's not the norm. All my toplevel grids respect the taskbar. Specify the emulator and Fx versions exactly. – H H Jan 08 '17 at 15:09
  • Clarification, I meant that the controls-behind-the taskbar is an interesting issue. I have never had a need to know the height of the taskbar. – H H Jan 08 '17 at 15:18
  • Added version info above. My particular app is a calculator, and it has a lot of different layouts generated by platform-independent code that expects to know the size of the region it can use. – William Jockusch Jan 08 '17 at 15:21
  • 1
    This problem seems related to the Mobile Emulator as when I tested in Lumia 640 the layout was right. I'd suggest you test with a real device. If the layout is right on the device, you can ignore this issue. – Jay Zuo Jan 09 '17 at 03:12

1 Answers1

1

A lot of googling finally turned up the following. I do it right after activating my Window.

      ApplicationView.GetForCurrentView().FullScreenSystemOverlayMode = FullScreenSystemOverlayMode.Minimal;

It actually doesn't fix the toy example above, but it does fix my real app. So it can't be the whole story. But it's a start for anyone who runs into this problem in the future.

William Jockusch
  • 26,513
  • 49
  • 182
  • 323