0
Windows 8アプリケーション用のログインページを作成しようとしています。 OneDriveのWindows 8版のように見せたいので、ScrollViewerにコンテンツを集中させようとしています。ただし、コントロールは、 'MaxWidth'プロパティを使用するとコンテンツを中央に配置できません。ここにその問題の例があります。Windows 8でMaxWidthを使用すると、ScrollViewerがコンテンツを中央揃えできない
<Page x:Class="App1.MainPage"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:local="using:App1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="1">
<StackPanel MaxWidth="900" Background="Red"/>
</ScrollViewer>
</Grid>
これを実行すると、赤いパネルがララの土地の右側に表示されます。 ScrollViewerをグリッドに置き換えると、コンテンツがどのようにレイアウトされるのかがわかります。 誰でもこの問題を回避する方法を知っていますか?