Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.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
C# 在ScrollViewer内的图像顶部覆盖网格_C#_Wpf_Grid - Fatal编程技术网

C# 在ScrollViewer内的图像顶部覆盖网格

C# 在ScrollViewer内的图像顶部覆盖网格,c#,wpf,grid,C#,Wpf,Grid,我有以下标记: <ScrollViewer> <StackPanel Orientation=Vertical> <Image /> <Grid /> <ItemsControl /> </StackPanel> </ScrollViewer> 好的,图像是一个动画加载gif。当一个事件完成时,程序显示网格和条目控件,用户可以上下滚动 为了做到这一点,目前我只

我有以下标记:

<ScrollViewer>
   <StackPanel Orientation=Vertical>
      <Image />
      <Grid />
      <ItemsControl />
   </StackPanel>
</ScrollViewer>

好的,图像是一个动画加载gif。当一个事件完成时,程序显示网格和条目控件,用户可以上下滚动

为了做到这一点,目前我只需将图像设置为
Visiblity='Collapsed'
,将
网格和
项控件设置为
Visible
。我如何对它们进行分层,使图像始终位于下方,网格和项目控件位于顶部,以便在淡出网格和项目控件时,图像显示在下方

我知道Z-Index有一个选项,我尝试将图像、网格和ItemsControl放置在画布中,并设置Panel.ZIndex属性,但它似乎不起作用-当我将网格上的不透明度设置为.5时,我看不到下面的图像,网格也没有填充空间(我需要它拉伸到表单的大小)。

这应该可以:

<ScrollViewer>
    <Grid>
        <Image/>
        <StackPanel>
            <Grid/>
            <ItemsControl/>
        </StackPanel>
    </Grid>
</ScrollViewer>