I am using DataListView from Bright Idea Software's ObjectListView to show real time data. I need to show double values correct upto 4 decimal point. How can I implement the same?
I suppose you currently use AspectName property to get/set value. Use the AspectGetter instead and format the return value as required.
Assuming you have an model object of type "Item" with a property "DoubleValue" of type double:
olvColumn1.AspectGetter += delegate(object rowObject) {
Item item = rowObject as Item;
return Math.Round(item.DoubleValue, 4);
};
You could also convert the DoubleValue using ToString(), but that would only be advisable if you do not need to edit the property from the OLV. Because the OLV "sees" the type you return from the AspectGetter (which would then be string instead of double) and not use a NumericUpDown control if you would try to edit the value.