中心内容XAML

时间:2014-01-06 21:29:52

标签: c# windows xaml

如何将元素置于XAML Windows 8.1的中心?在全屏幕上应用星标后设置边距我看到: enter image description here

<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"/>

在程序员模式下,我看到: enter image description here

1 个答案:

答案 0 :(得分:3)

使用HorizontalAlignmentVerticalAlignment中心尝试此操作。而不是利润。

<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"/>