2011-01-25 80 views

回答

1

可能是一个渐变应用到一个StackPanel最简单最好的办法是到边界内包含它:

<Border> 
    <Border.Background> 
    ... you gradient goes here ... 
    </Border.Background> 

    <StackPanel> 
    .. your content goes here ... 
    </StackPanel> 
</Border> 
+0

你为什么不直接将梯度应用到Stackpanel? – AnthonyWJones 2011-01-25 15:17:47

2

不知道你如何设法让这失败。有一个超级简单(丑陋的渐变)。工作正常: -

<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>