Windows Phone 7 开发积累_01
在Event标签中跳转或者增加事件无法成功,并弹出
“To generate an event handler the class 'XXXPage', specified by the x:Class or x:Subclass attribute, must be the first class in the file. Move the class code so that it is the first class in the file and try again. ”
原因是页面的局部类没有在cs文件的最前面,按下面的代码结构进行修改。
namespace PrettifyCtrlDemo.Page
{
//不要添加用户自定义类在Page类之前
public partial class TextBoxPage : PhoneApplicationPage
{
//....
}
//在这里添加用户自定义类
public class Person
{
public string Account { get; set; }
public string Password { get; set; }
}
}
关于图片的使用:
如果使用图片发现图片不显示,应该检查两点:
1. 检查图片的属性是否为"Content”.
2. 如果通过Uri导入本地图片,且图片在文件夹下,注意检查Uri的文件夹开始是否有"/".
string uri = "/Img/publish_loading_bottom" + Count.ToString("D2") + ".png";
this.image1.Source = new BitmapImage(new Uri(uri, UriKind.Relative));
对于无法显示的图片,可以拖一个Image控件,设置一下Source属性,Clean并Build一下程序看看能否显示,不能显示说明该Uri有问题,仔细检查一下吧。
页:
[1]