WPF 颜色渐变
1、颜色渐变(从上而下)
<Path Height="64" Stretch="Fill" Data="*"> <Path.Fill> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#1ca6ff" Offset="0.5"/> <GradientStop Color="#f8024e" Offset="1"/> </LinearGradientBrush> </Path.Fill> </Path>
2、颜色渐变(从左而右)
<Path Height="64" Stretch="Fill" Data="*"> <Path.Fill> <LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> <GradientStop Color="#1ca6ff" Offset="0.5"/> <GradientStop Color="#f8024e" Offset="1"/> </LinearGradientBrush> </Path.Fill> </Path>
3、颜色渐变(由外向内)
<Path Height="64" Stretch="Fill" Data="*"> <Path.Fill> <RadialGradientBrush Center="0.5,0.7" GradientOrigin="0.5,0.7" RadiusX="0.8" RadiusY="0.8"> <GradientStop Color="#1ca6ff"/> <GradientStop Color="#f8024e" Offset="0.952"/> <GradientStop Color="#3f52ff" Offset="0.162"/> </RadialGradientBrush> </Path.Fill> </Path>