b.pell
b.pell

Reputation: 4308

How to make a 100% input dialog using XAML in WinRT

I want to create a simple input dialog and I'm having a hard time getting it to stretch to 100% of the screen width (I can manually set width which is not what I want to do). I've tried the horizontal stretch, I've tried setting a left and right margin (hoping it would anchor the ends to the margin), I've tried specifying RowDefintiions in the grid with "*" Width. I can see in the XAML editor that the popup looks to be 100% of the screen width, but the Grid is not.

Take the below as a simple example.. I want the popup and/or the grid to span 100% width on the screen. Is there a straightforward way to accomplish this?

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

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">

    <Popup x:Name="pop" IsOpen="True" Margin="0,0,0,0">
        <Grid x:Name="popGrid" Background="Green" HorizontalAlignment="Stretch">
            <TextBlock Text="This is the popup where I will ask for input" HorizontalAlignment="Stretch"></TextBlock>
        </Grid>
    </Popup>

</Grid>

Upvotes: 0

Views: 1521

Answers (1)

Mayank
Mayank

Reputation: 8852

try

popGrid.Width = Window.Current.Bounds.Width;

Upvotes: 1

Related Questions