显示在网格背景
问题描述:
我如何可以存储和网格容器的背景显示一行一条线吗? 我必须设置每个资源字典的背景。显示在网格背景
<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>
或:
<Style TargetType="{x:Type Window}">
<Setter Property="Background">
<Setter.Value>
<!-- here I had to display a vertical line at bottom,
which goes over the whole window and set the background color-->
</Setter.Value>
</Setter>
</Style>
的问题是,我需要的红色页脚在应用程序的每个窗口。我使用ResourceDictionary
进行造型。我无法使用图片,因为我必须在运行时/为每个应用程序设置颜色。
答
您可以使用画笔itselft。
你可以画任何东西刷的visualbrush:http://msdn.microsoft.com/de-de/library/system.windows.media.visualbrush.aspx
只是做这样的事情
<VisualBrush>
...
<Grid Background="Red" .../>
<Line ... />
</VisualBrush>
+0
也就是说,我怎么可以在窗口的xaml使用它....我meen,我不能用这个在一个单独的resourcedictionary – user1565467 2012-08-10 13:57:00
你能表现出一定的XAML,并解释多一点你正在尝试做什么?你想要哪条线?垂直?水平?一条线?许多行?莫名其妙地与网格对齐? – 2012-08-10 13:55:23
我有一个网格,重写我的网格的标准样式。 的问题是,我不得不颜色设定为窗口中的每个申请的全部背景,并画垂直线,这是设置在底部,并具有窗口 的宽度为我的代码,见我的交...我有编辑它 – user1565467 2012-08-10 14:00:27
是有可能的窗口的背景设置为 颜色,并在太行一个选项? 与网格的想法是不是一个好主意,我认为^^ – user1565467 2012-08-10 14:05:58