【发布时间】:2019-05-12 14:35:27
【问题描述】:
我想在Button 上添加椭圆图像。但是当我在Button 上添加图像时,Button 的Background 颜色丢失了。我能做些什么 ?
<Button Height="80" Width="130"
BorderThickness="0">
<Label Content="Stephen King" FontFamily="Gabriola" FontSize="20"
Margin="0,30,0,0"></Label>
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="20"/>
</Style>
</Button.Resources>
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Ellipse Height="70" Width="70" Grid.Column="1">
<Ellipse.Fill>
<ImageBrush ImageSource="/Icons/stephen.jpg"/>
</Ellipse.Fill>
</Ellipse>
</ControlTemplate>
</Button.Template>
<Button.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
<GradientStop Color="#26C885" Offset="0" />
<GradientStop Color="#109489" Offset="1.0" />
</LinearGradientBrush>
</Button.Background>
</Button>
【问题讨论】: