WPF ZIndex未应用

时间:2015-03-19 13:47:08

标签: wpf xaml layout z-index

我的XAML的简化版本有这样的布局

<Border ..>
<StackPanel ..>
    <DockPanel Panel.ZIndex="0">
    ..
    </DockPanel>
    <Border Panel.ZIndex="100">
        <StackPanel>
            <Border Style="{StaticResource InfoBorder}" Focusable="False">
                <StackPanel>
                    <Label Margin="0,-5,0,0"  Focusable="False" >INFO.</Label>
                    <Grid Margin="20,0,0,0"  >
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30"/>

                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <ContentControl Grid.Column="0" Grid.Row="0" Content="{Binding Name}" Panel.ZIndex="100" KeyboardNavigation.IsTabStop="False"  />

                    </Grid>
                </StackPanel>
            </Border>
        </StackPanel>
    </Border>
    <DockPanel Panel.ZIndex="0" Height="30" Background="{StaticResource titleBarBlue}"  HorizontalAlignment="Stretch">
        <StackPanel Margin="0,5,0,0" HorizontalAlignment="Right" Orientation="Horizontal" Background="{StaticResource titleBarBlue}">
            <Image Source="..."  />
            <Label VerticalContentAlignment="Center" Content=".."/>
        </StackPanel>
    </DockPanel>
</StackPanel>

我遇到的问题是ZIndex未应用于Borders子级,因此ContentControl内容显示在最终的dockpanel后面。如何应用zindex以便内容控件内容始终呈现在最后一个按钮/图像上方?

0 个答案:

没有答案