2011-01-25 79 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>