Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml 如何使用RelativePanel指定以下布局?_Xaml - Fatal编程技术网

Xaml 如何使用RelativePanel指定以下布局?

Xaml 如何使用RelativePanel指定以下布局?,xaml,Xaml,我尝试了一些不同的RelativePanel.Align…附加属性组合,但我似乎无法按照我想要的方式解决问题 +--+---+--+ | |RED| | +------+ | | BLUE | | +------+--+ 如果我处在你的位置,我会使用网格 <!-- this version overlays Red beneath Blue, but aligned on the right --> <Rectangle x:Name="Red" RelativePa

我尝试了一些不同的
RelativePanel.Align…
附加属性组合,但我似乎无法按照我想要的方式解决问题

+--+---+--+
|  |RED|  |
+------+  |
| BLUE |  |
+------+--+

如果我处在你的位置,我会使用
网格

<!-- this version overlays Red beneath Blue, but aligned on the right -->
<Rectangle x:Name="Red" RelativePanel.AlignRightWith="Blue" />
<Rectangle x:Name="Blue" />

<!-- this version shoves Blue half off-screen -->
<Rectangle x:Name="Red" />
<Rectangle x:Name="Blue" RelativePanel.AlignRightWith="Red" RelativePanel.Below="Red" />

<!-- this version is a circular dependency -->
<Rectangle x:Name="Red" RelativePanel.AlignRightWith="Blue" />
<Rectangle x:Name="Blue" RelativePanel.Below="Red" />

是的,使用
网格很容易,但我只是在尝试新的UAP控件,想看看
RelativePanel
有什么可能。据我所知,
RelativePanel
是一个不错的选择,但在某些情况下,您仍然需要依赖基于显式
网格的布局。FWIW,我很确定第三个选项在同等的Android布局中不会是循环依赖性错误,所以如果微软有人注意到这个问题就好了。:)
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <Rectangle Fill="Red" Grid.Column="1" ... />
    <Rectangle Fill="Blue" Grid.Row="1" Grid.ColumnSpan="2" ... />
</Grid>