2
如果我在堆叠面板中使用,我只能使用LinearGradient为堆叠面板提供颜色背景,但不能在其上添加其他元素。将渐变应用于堆叠面板Silverlight中的背景颜色/图像
任何想法我该怎么做?
感谢名单
如果我在堆叠面板中使用,我只能使用LinearGradient为堆叠面板提供颜色背景,但不能在其上添加其他元素。将渐变应用于堆叠面板Silverlight中的背景颜色/图像
任何想法我该怎么做?
感谢名单
可能是一个渐变应用到一个StackPanel最简单最好的办法是到边界内包含它:
<Border>
<Border.Background>
... you gradient goes here ...
</Border.Background>
<StackPanel>
.. your content goes here ...
</StackPanel>
</Border>
不知道你如何设法让这失败。有一个超级简单(丑陋的渐变)。工作正常: -
<StackPanel>
<StackPanel.Background>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="Black" Offset="0" />
<GradientStop Color="#FFC95AFF" Offset="0.484" />
<GradientStop Color="#FF3E5E7F" Offset="0.242" />
</LinearGradientBrush>
</StackPanel.Background>
<TextBlock Foreground="White" Text="Hello World" />
</StackPanel>
你为什么不直接将梯度应用到Stackpanel? – AnthonyWJones 2011-01-25 15:17:47