【发布时间】:2010-08-05 18:31:49
【问题描述】:
我一直在玩在 XAML 中声明对象。我的 Silverlight 程序集中有这些类:
public class TextItem
{
public string TheValue { get; set; }
}
public class TextItemCollection
{
public ObservableCollection<TextItem> TextItems { get; set; }
}
然后,我的 XAML 中有这个:
<UserControl.Resources>
<app:TextItemCollection x:Key="TextItemsResource">
<app:TextItemCollection.TextItems>
<app:TextItem TheValue="Hello world I am one of the text values"/>
<app:TextItem TheValue="And I am another one of those text items"/>
<app:TextItem TheValue="And I am yet a third!"/>
</app:TextItemCollection.TextItems>
</app:TextItemCollection>
</UserControl.Resources>
由于某种原因,如果我在尝试调试应用程序时包含该节点,Silverlight 会挂起(我只看到旋转的蓝色加载圆圈)。如果我注释掉那个节点,它会立即运行。
有什么想法吗?
【问题讨论】:
-
您是否尝试过在 App.xaml 的 UnhandledException 处理程序中放置断点? VS 会在 SL 应用程序的某些部分错过异常,但如果您在 Application.UnhandledException 处理程序的开头中断,您将能够看到正在抛出的异常。
-
好主意。但不,它只是旋转,我从未达到断点。
标签: silverlight xaml