本示例使用 WPF 制作一个下载按钮。以下 XAML 代码显示了程序如何构建该按钮。
<Window x:Class="howto_download_button.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="107" Width="140" Loaded="Window_Loaded"
WindowStyle="ToolWindow">
<Grid Background="Transparent" Name="grdMain">
<!-- The button's background -->
<Ellipse Margin="5" StrokeThickness="5">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="LightGreen" Offset="0"/>
<GradientStop Color="#FF00C000" Offset="1"/>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<!-- Text -->
<TextBlock FontFamily="Arial Rounded MT" FontSize="20"
FontWeight="Bol