Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.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# 在网格背景上显示一条线_C#_Wpf_Xaml_Styles - Fatal编程技术网

C# 在网格背景上显示一条线

C# 在网格背景上显示一条线,c#,wpf,xaml,styles,C#,Wpf,Xaml,Styles,如何在网格容器的背景中存储和显示行? 我必须设置每个资源字典的背景 <Style TargetType="{x:Type Grid}"> <Setter Property="Background"> <Setter.Value> <!--here I had to display a vertical line at bottom, which goes over the w

如何在网格容器的背景中存储和显示行? 我必须设置每个资源字典的背景

<Style TargetType="{x:Type Grid}">
    <Setter Property="Background">
        <Setter.Value>
            <!--here I had to display a vertical line at bottom,
                which goes over the whole window -->
        </Setter.Value>
    </Setter>
</Style>

或:



问题是我需要在应用程序的每个窗口中显示红色的页脚。我使用
ResourceDictionary
进行样式设置。我不能使用图片,因为我必须在运行时/为每个应用程序设置颜色。

您可以自己使用画笔

使用visualbrush,您可以将任何内容绘制为笔刷:

就这么做吧

<VisualBrush>
...
<Grid Background="Red" .../>
<Line ... />

</VisualBrush>

...

您能展示一些XAML并进一步解释一下您想做什么吗?你要这条线在哪里?竖的水平的一行?多行?以某种方式与网格对齐?我有一个网格,它覆盖了我网格的标准样式。问题是,我必须为窗口的每个应用程序的整个背景设置一种颜色,并绘制一条垂直线,该垂直线设置在底部,具有我代码的窗口宽度,请参阅我的帖子。。。我已经编辑过了,也许有一个选项可以将窗口的背景设置为一种颜色,也可以设置线条?使用网格的想法不是一个好主意,我想^^也就是说,我如何在窗口的xaml中使用它。。。。我知道,我不能在单独的字典里用这个
<VisualBrush>
...
<Grid Background="Red" .../>
<Line ... />

</VisualBrush>