Well that is odd. How come the ultralistviewitem text propery does not have a setter?
How then does one set the text on ultralistviewitem then?
Hello ,
UltraListViewItem will calls ToString() method of the object, stored in its Value property, in order to display its Text. So you if you want to have an object in Value property of UltraListViewItem, you could override its ToString() method. For example let say that you have a class AAA and you want to have UltraListViewItem with value of AAA class, which should display “BBB” as text. Then you could use code like:
class AAAA
{
public object Val{get;set;}
public override string ToString()
return "BBBB";
}
// code omitted
UltraListViewItem i = new UltraListViewItem(new AAAA(){ Val = "AAAA"},null);
ultraListView1.Items.Add(i);
Please let me know if you have any further questions.
Hello!
I have a case like this, but a little different.
My project consists of a class library Project and an application project.
The class that is used in the ListView comes from that class library. The problem is that the application handles all translations (Swedish, Norweigan etc.), so I am
unable to do any translations in the ToString override function. I would like to show translated text in the listview Control, but I don't know how to do this.
Any ideas?
/Henrik
Works perfect, thanks!
Assign the text you want to display to the UltraListViewItem's Value property, and assign a reference to the class library object associated with the UltraListViewItem to the UltraListViewItem's Tag property. Wherever you need to access the underlying class library object, you would upcast the contents of the Tag property to that type.