2010-10-13 144 views

回答

0
<Style x:Key="StyleButton" TargetType="{x:Type Button}"> 
    <Setter Property="FontFamily" Value="Tahoma"></Setter> 
      <Setter Property="Height" Value="50"></Setter> 
      <Setter Property="Width" Value="100"></Setter> 
      <Setter Property="Foreground" Value="Blue"></Setter> 
      <Setter Property="Background"> 
       <Setter.Value> 
        <LinearGradientBrush> 
         <LinearGradientBrush.GradientStops> 
          <GradientStop Offset="0" Color="White"></GradientStop> 
          <GradientStop Offset="1" Color="Lime"></GradientStop> 
          <GradientStop Offset="2" Color="Yellow"></GradientStop> 
         </LinearGradientBrush.GradientStops> 
        </LinearGradientBrush> 
       </Setter.Value> 
      </Setter> 
      <Style.Triggers> 
       <MultiTrigger> 
        <MultiTrigger.Conditions> 
         <Condition Property="IsFocused" Value="True"/> 
         <Condition Property="IsMouseOver" Value="True"/> 
        </MultiTrigger.Conditions> 
        <Setter Property="Foreground" Value="Yellow"/> 
        <Setter Property="Background"> 
         <Setter.Value> 
          <LinearGradientBrush> 
           <LinearGradientBrush.GradientStops> 
            <GradientStop Color="blue" Offset="0"/> 
            <GradientStop Color="#CC00FF" Offset="1"/> 
            <GradientStop Color="#FF00CC" Offset="2"/> 

           </LinearGradientBrush.GradientStops> 
          </LinearGradientBrush> 
         </Setter.Value> 
        </Setter> 
       </MultiTrigger> 
      </Style.Triggers> 
     </Style> 
+0

我建議在答案中增加一個描述,因爲這個特定的代碼可能無助於2年前問這個問題的OP。對於面臨類似挑戰的人來說,解釋會更有幫助。 – MasterAM 2013-07-05 21:07:05

相關問題