报错为什么?


提示错误:Application_UnhandledException

Favorite 是一LonglistSelector

执行这两行后就开始报错了,为什么?

{
ItemViewModel cat = (ItemViewModel)Favorite.SelectedItem;
String dog= cat.LineTwo;
}

c# wp8

你其实是个好人 10 years, 3 months ago

 ItemViewModel cat = Favorite.SelectedItem as ItemViewModel;
if(cat != null)
{
    String dog = cat.LineTwo;
}

人偶·厌夜 answered 10 years, 3 months ago

Your Answer