问题
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;
}
This seems to work so far and I managed to populate a list of this type with 830 entries.
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:
A first chance exception of type 'BrightIdeasSoftware.MungerException' occurred in ObjectListView.dll
I can't seem to retrieve more information on this exception, unfortunately, and google isn't really telling me anything either.
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.
Why is this exception thrown, how can I prevent it and am I doing this OLV thing correctly?
回答1:
Answer: The properties are set to private, and they should've been public. Once I switched that around, all was well.
Credit goes to drch on the C# chat for this amazing answer.
来源:https://stackoverflow.com/questions/17107791/exception-when-adding-list-to-objectlistview