i'm using a FastObjectListView that can contain two different types of objects. It could be an object from type Testaction
or from Milestone
. If it is an object from type Testaction
there is a property called Successful
on which i decide whether to show a green or a red image. If the object is from type Milestone
there is a property Result
which is a %-Number. Now i want to be able to show a image or that %-number in the same column.
this.olvColumn9.ImageGetter = delegate(object rowObject)
{
Testaction action = rowObject as Testaction;
if (action.Successful)
{
return 0;
}
else
{
return 1;
}
};
This is setting the image to the column. The images are stored in a ImageList. But i just don't know how to set a text into the column if it's not from type Testaction
.
I would be grateful for any help.
Relax
In case the object type is Milestone
it should work to return NULL from the ImageGetter handler and to return the respective string from the AspectGetter of the column.
Something like this (code not checked for syntax and function):
this.olvColumn9.ImageGetter = delegate(object rowObject) {
if (rowObject is Testaction) {
Testaction action = rowObject as Testaction;
if (action.Successful) {
return 0;
} else {
return 1;
}
} else {
return null;
}
};
this.olvColumn9.AspectGetter = delegate(object rowObject) {
if (rowObject is Milestone) {
return ((Milestone)rowObject).Result.ToString();
}
};