Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1440
How does one set the text on ultralistviewitem, Text property has only get
posted

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?

Parents
  • 48586
    posted

    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.

Reply Children