给图象作为按钮控制的背景

时间:2012-04-12 03:41:25

标签: windows windows-phone-7

我的资源中有一张图片,我想在Windows手机中将其作为按钮的背景提供。 怎么做? 我试过这个,但是出错了

<Button Content="" HorizontalAlignment="Left" BorderBrush="Transparent" Margin="131,681,0,0" Name="button2" Width="81" Grid.Row="1" Click="button2_Click" Height="64" VerticalAlignment="Top" Background="Images/pause.png"/>

1 个答案:

答案 0 :(得分:4)

试试这个,

    <Button Content="" HorizontalAlignment="Left" Margin="114,36,0,0" Grid.Row="1" VerticalAlignment="Top">
        <Button.Background>
            <ImageBrush Stretch="Fill" ImageSource="/Images/pause.png"/>
        </Button.Background>
    </Button>