Dar*_*arf 2 c# wpf treeview xaml binding
我收到此错误:"在树状视图中使用itemssource之前,项目集合必须为空".我的XAML代码只包含:
<TreeView ItemsSource="{Binding Groups}">
</TreeView>
Run Code Online (Sandbox Code Playgroud)
组是一个只包含两个属性的类:GroupID和GroupName.我确定我的收藏品中有物品,但我不确定这是什么原因导致thix异常.
如果您将项目添加到Items
集合并使用ItemsSource
,例如,则会发生此错误
<ListBox ItemsSource="{Binding Data}">
<ListBoxItem Content="A concrete item"/>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
你当然可以在代码中创建这样的问题.因此,请确保您没有在某处手动添加任何内容.
归档时间: |
|
查看次数: |
1962 次 |
最近记录: |