在数据网格 wpf 中使用带有复选框控件的 ItemsSource 之前,项目集合必须为空 [英] Items collection must be empty before using ItemsSource with checkbox control in datagrid wpf

查看:26
本文介绍了在数据网格 wpf 中使用带有复选框控件的 ItemsSource 之前,项目集合必须为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此错误仅在我添加以下 XAML 代码时发生:

This error only occurs when I add this following XAML code :

 <DataGridTemplateColumn Header="Ist aktiv" IsReadOnly="True">
     <DataGridTemplateColumn.CellTemplate>
         <DataTemplate>
             <CheckBox IsChecked="{Binding IsActiveBool}"  />
          </DataTemplate>
     </DataGridTemplateColumn.CellTemplate>
 </DataGridTemplateColumn>

</DataGrid>

推荐答案

出现此错误的可能原因有很多,其中大部分(如果不是全部)已经在 StackOverflow 上讨论过.看看以下帖子:

There are a number of possible reasons why you got this error, most (if not all) of which have already been discussed here on StackOverflow. Take a look at the following posts:

在使用 ItemsSource 之前,项目集合必须为空银光

错误:在使用 ItemsSource 之前,项目集合必须为空

获取物品收藏"在使用 ItemsSource 之前必须为空"和 EF

DataGridTemplateColumn :在使用 ItemsSource 之前,Items 集合必须为空.

在使用 ItemsSource 之前,项目集合必须为空

如果您在这些帖子中没有找到答案,也许您可​​以自己进行搜索……SO 用户通常最好在 在这里提问之前进行搜索.

If you don't find an answer in these posts, perhaps you could do your own search... it is generally preferable for SO users to search before they ask questions here.

这篇关于在数据网格 wpf 中使用带有复选框控件的 ItemsSource 之前,项目集合必须为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆