我想做一个简单的布局:这是我的代码:
<ScrollViewer Grid.Column="1" Grid.Row="1" HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Disabled" VerticalContentAlignment="Stretch">
<StackPanel Name="MainStack" Orientation="Horizontal">
<StackPanel Width="800" Height="800" Margin="140,0,10,0" Background="#FFAC3737"/>
<StackPanel Width="400" Height="800" Margin="0,0,10,0">
<StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" Margin="0,0,0,10" />
<StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="400" Height="800" Margin="0,0,10,0">
<StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" Margin="0,0,0,10" />
<StackPanel Width="400" Height="395" Background="Black" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="400" Height="800" Margin="0,0,10,0">
<StackPanel Width="400" Height="395" Background="#FF5686AE" HorizontalAlignment="Left" Margin="0,0,0,10" />
<StackPanel Width="400" Height="395" Background="#FF5583AA" HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Width="400" Height="800" Margin="0,0,10,0">
<StackPanel Width="400" Height="395" Background="#FF5180A8" HorizontalAlignment="Left" Margin="0,0,0,10" />
<StackPanel Width="400" Height="395" Background="#FF426E93" HorizontalAlignment="Left" />
</StackPanel>
</StackPanel>
</StackPanel>
</ScrollViewer>
现在它看起来像这样:
将此布局扩展到所有分辨率的最佳方法是什么?