将列表添加到ObjectListView时发生异常 [英] Exception when adding list to ObjectListView
问题描述
我刚开始使用ObjectListView,并且试图替换以前在应用程序中使用的ListView.我设法使用以下类型建立了一个列表:
I just started with ObjectListView, and I am trying to replace the ListView I used before in my application. I managed to build a list using the following type I made:
public class Record
{
public bool IsActive = true;
public Record(string barcode, string info, string desc)
{
this.barcode = barcode;
this.info = info;
this.desc = desc;
}
private string Barcode
{
get { return barcode; }
set { barcode = value; }
}
private string barcode;
private string Info
{
get { return info; }
set { info = value; }
}
private string info;
private string Desc
{
get { return desc; }
set { desc = value; }
}
private string desc;
}
到目前为止,这似乎仍然有效,我设法用830个条目填充了此类型的列表.
This seems to work so far and I managed to populate a list of this type with 830 entries.
但是,当我尝试使用OLV.SetObjects(list)
使用此列表填充OLV时,OLV会吓跑并在调试输出中向以下异常发送垃圾邮件,但永远不会结束:
When I try to fill the OLV with this list using OLV.SetObjects(list)
, however, OLV freaks out and spams the following exception in the debug output, never ending:
ObjectListView.dll中发生了'BrightIdeasSoftware.MungerException'类型的第一次机会异常
A first chance exception of type 'BrightIdeasSoftware.MungerException' occurred in ObjectListView.dll
不幸的是,我似乎无法检索到有关此异常的更多信息,并且google也没有告诉我任何信息.
I can't seem to retrieve more information on this exception, unfortunately, and google isn't really telling me anything either.
我在OLV中使用的列的方面名称为条形码",信息"和描述".我希望这是使用OLV的正确方法,因为我发现文档相当混乱,并且很难理解它-演示项目也没有太大帮助.
The columns I use in my OLV have the aspectnames "barcode", "info" and "desc". I hope this is the right way to use OLV, as I find the documentation rather confusing and have a hard time understanding it at all - the demo project isn't much help either.
为什么会引发此异常,如何防止该异常,并且我是否正确地执行了此OLV操作?
推荐答案
答案:该属性设置为私有,并且应该是公开的.一旦我改变了一切,一切都很好.
Answer: The properties are set to private, and they should've been public. Once I switched that around, all was well.
信贷可以在C#聊天中获得令人惊叹的答案.
Credit goes to drch on the C# chat for this amazing answer.
这篇关于将列表添加到ObjectListView时发生异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!