Center Content XAML

c#, windows, xaml

Solution

Try this, using `HorizontalAlignment` and `VerticalAlignment` center. And not the margins.

<ProgressRing   Name="Load" 
                IsActive="True" 
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Foreground="White"/>

<TextBlock  TextWrapping="Wrap" 
            Text="Caricamento..." 
            FontSize="50" 
            HorizontalAlignment="Center"
            VerticalAlignment="Center"
            IsRightTapEnabled="False" 
            IsHoldingEnabled="False" 
            IsDoubleTapEnabled="False" 
            IsTapEnabled="False" 
            Foreground="White"/>

Problem

How to center the element on XAML Windows 8.1? When set the margin after star application on full screen i see this: ``` <ProgressRing Name="Load" IsActive="True" HorizontalAlignment="Stretch" Margin="672,373,674,373" VerticalAlignment="Stretch" Foreground="White"/> <TextBlock Margin="528,466,526,256" TextWrapping="Wrap" Text="Caricamento..." FontSize="50" IsRightTapEnabled="False" IsHoldingEnabled="False" IsDoubleTapEnabled="False" IsTapEnabled="False" Foreground="White"/> ``` in programmer mode i see this:

Original source