Visual studio 2010 Windows Phone 7.1-如何更改按键时的背景图像?

Visual studio 2010 Windows Phone 7.1-如何更改按键时的背景图像?,visual-studio-2010,image,windows-phone-7,c#-4.0,Visual Studio 2010,Image,Windows Phone 7,C# 4.0,如何更改某些画布的背景图像,使其不必按按钮上的c#代码?我知道如何更改背景颜色: Canvas1.Background = new SolidColorBrush(Colors.Red); 我在网上找到了一个教程,但是VS说“找不到类型或命名空间名称‘BitmapImage’(是否缺少using指令或程序集引用?) 我错过了什么 蒂亚 您需要添加对System.Windows.Media.Imaging命名空间的引用。将此项添加到类的顶部,其中使用指令的其他项是 using System.Wi

如何更改某些画布的背景图像,使其不必按按钮上的c#代码?我知道如何更改背景颜色:

Canvas1.Background = new SolidColorBrush(Colors.Red);
我在网上找到了一个教程,但是VS说“找不到类型或命名空间名称‘BitmapImage’(是否缺少using指令或程序集引用?)

我错过了什么


蒂亚

您需要添加对
System.Windows.Media.Imaging
命名空间的引用。将此项添加到类的顶部,其中使用指令的其他
项是

using System.Windows.Media.Imaging;
using System.Windows.Media.Imaging;