Panel.Zindex在Wpf中不能处理子项

时间:2016-05-23 13:07:24

标签: wpf xaml silverlight

这是我的Xaml,

 <Grid Background="Transparent">

<ScrollViewer Name="Sv1" Margin="0 20 0 0 ">
   <StackPanel Orientation="Horizontal">
        <TextBlock Text="   Ok  " />
        <TextBlock Text="   Ok  " />
        <TextBlock Text="   Ok  " />
        <TextBlock Text="   Ok  " />
        <TextBlock Text="   Ok  "  Name="BtnOk"
                   Foreground="Red" 
                   MouseLeftButtonDown="UIElement_OnMouseLeftButtonDown"
                   Panel.ZIndex="5000" />
        <TextBlock Text="   Ok  " />

    </StackPanel>
</ScrollViewer>
<ScrollViewer Name="Sv2"  Margin="0 20 0 0 "
    VerticalScrollBarVisibility="Auto" 
    HorizontalScrollBarVisibility="Auto">
    <VirtualizingStackPanel Orientation="Horizontal">
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />
        <TextBlock Text="   This Test    " Panel.ZIndex="5" />

        <Rectangle Canvas.Right="10" Margin="10 0 0 0"  Fill="Red" Width="254" HorizontalAlignment="Right"/>
   </VirtualizingStackPanel>
</ScrollViewer>

我希望“Sv2”超过“Sv1” - 这没关系 - 我想点击“BtnOk”,但不能正常工作MouseLeftButtonDown?

如果“Sv1”在“Sv2”上,则单击“提升”,但如果“Sv2”超过“Sv1”,则单击“提升”。

0 个答案:

没有答案