日期:2014-05-18  浏览次数:20967 次

请问如何在xaml中定义这样的grid?
如果window为宽屏幕(16:9),Grid为window中央4:3区域,如果window为标准屏(4:3),那么Grid为windows所有区域,请问这样的条件Grid在xaml中如何定义?

------解决方案--------------------
最简单可以理解为:
XML code

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Viewbox>
        <Grid Width="800" Height="600" Background="Yellow">

        </Grid>
    </Viewbox>
</Window>