向边框或stackpanel silverlight添加渐变

时间:2011-06-14 09:01:49

标签: silverlight

如何向边框或堆叠面板添加一点渐变,使其前部看起来像是有一点渐变或曲线使它看起来有点像3d

谢谢, 简

1 个答案:

答案 0 :(得分:0)

您可以为边框定义自定义LinearGradientBrush,如此

<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" x:Key="MyBorderBrush">
    <GradientStop Offset="0" Color="#FFFFFF"/>
    <GradientStop Offset="1" Color="#FFFFFF"/>
</LinearGradientBrush>

要应用边框,请在边框处添加边框画笔

<Border BorderBrush="{StaticResource MyBorderBrush}" BorderThickness="1" CornerRadius="4">
    <!-- Content -->
</Border>