Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/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
C# 带有DockPanel的透明文本块_C#_Wpf_Xaml - Fatal编程技术网

C# 带有DockPanel的透明文本块

C# 带有DockPanel的透明文本块,c#,wpf,xaml,C#,Wpf,Xaml,我想创建一个启动屏幕,其中图像和加载状态(带有进度条的文本块)位于另一个屏幕的顶部 我编写了下一个代码: <Window WindowStyle="None" ResizeMode="NoResize" d:DesignHeight="300" d:DesignWidth="300"> <DockPanel LastChildFill="True"> <Grid DockPanel.Dock="Bottom" Backgr

我想创建一个启动屏幕,其中图像和加载状态(带有进度条的文本块)位于另一个屏幕的顶部

我编写了下一个代码:

<Window 
        WindowStyle="None" ResizeMode="NoResize"
         d:DesignHeight="300" d:DesignWidth="300">
<DockPanel LastChildFill="True">
    <Grid DockPanel.Dock="Bottom" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding Text}" Grid.Row="0" Background="Transparent"/>
        <ProgressBar Maximum="100" Value="{Binding ProgressValue, Mode=OneWay}" Height="5" Grid.Row="1" IsIndeterminate="{Binding IsIndeterminate}"/>
    </Grid>
    <Image Source="{Binding ImageSource}" Stretch="None"/>
</DockPanel>


不幸的是,TextBlock仍然会删除它位于顶部的图片的某些部分。我认为原因是DockPanel,但我不确定如何以其他方式执行。

TextBlock
不会删除图像的一部分,因为它不在图像的顶部,而是在图像的下方。这是因为
DockPanel
没有将孩子放在彼此的上面。如果要将内部
网格
置于
图像
之上,最简单的解决方案是将
DockPanel
替换为
网格