Align Popup to Center

3

Why can not I align to the center, this my popup?

LookhowitlooksinXAMLDesign

Follow my XAML :

<Popup x:Name="popup" HorizontalAlignment="Center" VerticalAlignment="Center">
    <StackPanel Background="Black" Width="456">
        <TextBlock Text="Selecione uma ação:" Name="lblInformaPopup" Margin="10,0" VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle2Style}" />
        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Top">
            <Image Name="imgPhone" Source="Assets/Images/telefone.png" Width="70" Height="70" Tap="imgPhone_Tap" />
            <Image Name="imgGps" Source="Assets/Images/gps.png" Width="70" Height="70" Tap="imgGps_Tap" Margin="15,0,0,0"  />
            <Image Name="imgEmail" Source="Assets/Images/email.png" Width="70" Height="70" Margin="15,0,0,0"  />
        </StackPanel>
    </StackPanel>
</Popup>

Suggestions?

    
asked by anonymous 30.04.2014 / 20:08

1 answer

1

You should set the dimensions of the Popup tag to be able to center it.

For example:

<Popup x:Name="popup" HorizontalAlignment="Center" VerticalAlignment="Bottom" Width="456" Height="70">
    <StackPanel Background="Black" Width="Auto" HorizontalAlignment="Center">
        <TextBlock Text="Selecione uma ação:" Name="lblInformaPopup" Margin="10,0" VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle2Style}" />
        <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Top">
            <Image Name="imgPhone" Source="Assets/Images/telefone.png" Width="70" Height="70" Tap="imgPhone_Tap" />
            <Image Name="imgGps" Source="Assets/Images/gps.png" Width="70" Height="70" Tap="imgGps_Tap" Margin="15,0,0,0"  />
            <Image Name="imgEmail" Source="Assets/Images/email.png" Width="70" Height="70" Margin="15,0,0,0"  />
        </StackPanel>
    </StackPanel>
</Popup>

In this case, I set the dimensions for <Popup> and <StackPanel> inherits the dimensions of <Popup> using Auto .

    
30.04.2014 / 22:20