Windows phone 7 如何在其中强制元素溢出网格

Windows phone 7 如何在其中强制元素溢出网格,windows-phone-7,layout,Windows Phone 7,Layout,我有以下的布局 <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid Height="100" Background="Wheat" Opacity="0.4"> <StackPanel Orientation="Vertical" VerticalAlignment="Bottom"> <Slider Orientation="Vertical

我有以下的布局

<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid Height="100" Background="Wheat" Opacity="0.4">
        <StackPanel Orientation="Vertical" VerticalAlignment="Bottom">
            <Slider Orientation="Vertical" Height="170" HorizontalAlignment="Center" Background="White" />
            <Button Content="Btn" Width="100"/>
        </StackPanel>
    </Grid>
</Grid>

在这个场景中,网格将剪辑溢出网格的滑块的其余部分。 所以我得到了这样的结果 而我想得到这样的结果 那个么,如何在不剪切的情况下强制滑块溢出网格呢?是否有其他解决方案?
事实上,我有更复杂的布局,所以现在欢迎使用画布而不是网格。

您可以使用单个
网格
并使用其子对象的
网格.RowSpan
网格.ColumnSpan
属性来实现这一点

<Grid x:Name="LayoutRoot"
      Background="Transparent">
  <Grid.RowDefinitions>
    <RowDefinition Height="*" />
    <RowDefinition Height="Auto" />
    <RowDefinition Height="Auto" />
    <RowDefinition Height="*" />
  </Grid.RowDefinitions>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
    <ColumnDefinition Width="Auto" />
    <ColumnDefinition Width="*" />
  </Grid.ColumnDefinitions>

  <Rectangle Grid.Row="2"
             Grid.Column="0"
             Grid.ColumnSpan="3"
             Height="100"
             Fill="Wheat"
             Opacity="0.4" />

  <StackPanel Grid.Row="1"
              Grid.RowSpan="2"
              Grid.Column="1">
    <Slider Orientation="Vertical"
            Height="170"
            HorizontalAlignment="Center"
            Background="White" />
    <Button Content="Btn"
            Width="100" />
  </StackPanel>
</Grid>


是否需要外部
网格(“LayoutRoot”),最好将其更改为
DockPanel
,除非出于其他原因需要网格。我不能使用单个网格,但使用您的示例重建了布局。