windows - 将图像作为按钮控件的背景

标签 windows windows-phone-7

我的资源中有一张图片,我想将其作为我在 Windows Phone 中的按钮的背景。 怎么做? 我试过了,但是报错

<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"/>

最佳答案

试试这个,

    <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>

关于windows - 将图像作为按钮控件的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10117078/

相关文章:

python - Windows 上的配置文件位置/在 %APPDATA% 中创建目录

windows - 适用于 Windows Phone 的 XNA 游戏开发

c# - 如何使用 Storyboard为 Stackpanel 的边距设置动画?

c# - 在 Windows Phone 7 上从独立存储打开 JPEG 时出现问题

windows - 使用 ARR 并更改端口

windows - 如何在 Windows 操作系统上安装 influxdb 并访问管理控制台

Windows批处理文件,在标签之间找到一个字符串

c# - WP7,将服务引用添加到 Visual Studio 2010 后如何使用它

error-handling - wp7错误处理

windows - Windows程序文件夹中全局可写批处理文件的安全问题