- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在开发一个 Winform,我需要一个 checkedlistbox。我将值存储在一个具有 List 属性的对象中:
public static class Fields
{
public static IList<string> FieldList { get; set; }
static Fields()
{ ...//populate FieldList }
}
现在我希望我的 CheckedListBox 使用 Fields.FieldList 作为数据源。在网上搜索后发现需要设置
//in myForm_Load
mycheckedListBox.DataSource = Fields.FieldList;
但是 myCheckedListBox 没有 DataSource 属性。
我是不是漏掉了什么?
最佳答案
根据文档,它应该具有此属性... http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.datasource(VS.90).aspx
不过,前一段时间我在一个项目上也遇到了同样的问题,并使用了this CodeProject article在我需要此功能的一个项目中编写解决方案。
进一步研究,我确实发现了这个:
编辑:上面的链接不再有效,但下面的摘录来自曾经存在于那里的文章。
Posted by Microsoft on 5/30/2005 at 10:28 AM
Thanks for the feedback however this is by design. We do not support data binding on the CheckedListBox control. These properties are inherited from it base class and cannot be removed so we hid them form the property grid and IntelliSense.
这解释了为什么该属性存在,但未在 Intellisense 中显示。
这篇博文也值得一读:http://waxtadpole.wordpress.com/2009/10/12/assigning-custom-class-to-checkedlistbox-datasource/
关于c# - 为什么checkedlistbox没有数据源?如何绑定(bind)到值列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8215933/
我编写了以下类来创建使用自然排序算法的 CheckedListbox。被覆盖的 Sort()然而,方法并没有被解雇。 (该方法中的代码来自 MSDN 示例,关于如何在常规列表框上实现您自己的排序算法。
我在创建 CheckedListBox 的“二级”时遇到了一些问题。 示例: 这是我的 CheckedListBox: 代码: checkedListBox_materiałyDoRozliczen
我有: ListenCheckedListBox.SetItemCheckState(0, CheckState.Unchecked); 这个赋值会触发 ListBox 的 ItemCheck 事件吗
我有一个包含两个元素的表单:一个CheckedListBox 和一个CheckBox。 CheckBox 称为SelectAllCheckBox,用于选中/取消选中CheckedListBox 中的所
我需要改变我的 CheckedListBox 中项目的颜色,但“alternatingColors”不是 CheckedListBox 的属性。 如何让项目的颜色交替? 最佳答案 默认情况下,OnDr
我有一个使用此代码获取项目的 CheckedListBox。 public static void GetDisplayValueList(object clk, string[] kv, strin
我想在一个应用程序中使用 CheckedListBox,其中 ListBox 中的每个项目都是我硬盘上一个文件夹的名称,并且为了在这些文件夹中的每个文件夹中读取和写入文本文件,我想确保在 Checke
我在一个表单上有多个 checkedListBox。对于每个 checkedListBox 我都有一个按钮来“选择所有”项目: private void btnSelectAll1_Click(obj
我需要覆盖基本的 CheckedListBox 行为。 可以在不附加任何代码的情况下选中和取消选中 CheckedListBox。 我需要禁用此行为,以便我可以实现自定义代码。 有什么想法吗? 谢谢。
在 .NET 领域,有非常有用的 System.Windows.Forms.CheckedListBox类。 Windows Common Controls 中的等价物是什么? (如果有的话) 最佳答
在我的 CheckedListBox 应用程序中,我只想允许检查一个项目。 我已经设置了这些属性 checkOnClick = true; SelectionMode = One; 任何建议将不胜感激
当用户的鼠标悬停在 CheckedListBox 中的项目上时,是否有一种直接的方法来设置在工具提示中显示额外的文本? 我期望能够在代码中做的是: uiChkLstTables.DisplayOnHo
我有一个名为 Subjects 的集合,其属性为字符串中的名称和整数中的 SubjectCode。我将它传递给一个选中的列表框。按下按钮,我想获取用户检查的所有项目的集合,将其转换为集合主题。 请任何
我在 Windows 窗体中有一个 CheckedListBox 控件。 我想知道向谁添加多列。MultiColumn 属性设置为 true。我只想知道添加 2 列的编码。 我的代码是 while (
在 .NET Framework 中,是否可以将 CheckedListBox 中的某些项目设置为“不可选中”?我不想让用户再次检查相同的项目并将它们添加到另一个现有列表中。 我希望我是清楚的。提前致
我为 Windows 窗体应用程序创建了一个用户控件。它只有一个带有四个单元格的 TableLayoutPanel。 Cell[0,0] 和 cell[0,1] 有标签。 Cell[1,0] 有一个
我想根据传递给表单构造函数的项目填充 CheckedListBox(在本例中,列表 )。 我的框架代码是: foreach (int platypus in listPlatypi) { us
我有一个像这样的CheckedListBox: :'''''''''''''''/\ : [ ] item1 || : [x] item2 || : [ ] item3 ##
是否可以像在复选框中一样将 .Checked== 应用于 checkedlistbox? 如果以复选框的方式来做它是行不通的 if(checkedListBox1.Items[2].Checked==
我有一个绑定(bind)到 DataTable 的 CheckedListBox。现在我需要以编程方式检查一些项目,但我发现 SetItemChecked(...) 方法只接受项目索引。 有没有一种实
我是一名优秀的程序员,十分优秀!