Search code examples
vb.netobjectlistview

How to add Description using DescribedTaskRender - ObjectListView VB.net


I've been wondering how do I achieve something along the lines of this: Task List

What I'm looking for is adding description under the title for example in the image the title is Setup Spy Camera and the description is 'Install spy camera blah blah blah'

I've read the documentation and I heard I'm supposed to use DescribedTaskRender. However I did not see any results. This is my code:

Public Class Shownames
        Public Property Title As String
        Public Property Description As String
        Public Property Score As String
        Public Property Episode As String
        Public Property ID As String
End Class

Dim ShowItemCollection as Shownames

   Showitemcollection.Title = ShowTitle
   Showitemcollection.Description = ShowDescription
   Showitemcollection.Score = ShowScore
   Showitemcollection.Episode = ShowEpisode
   Showitemcollection.ID = ShowID

ObjListview.addobject(ShowItemCollection)

I want ShowDescription to appear under Shownames. I've already named the DescriptionAspectName as Description but it still doesn't work. Can someone help me?

I also tried adding an image using imagelist using this: Imagelist1.Images.Add(Image.FromFile(Filepath))

but it doesn't show as well despite having associated the imagelist to describedtaskrender.


Solution

  • To use a DescribedTaskRender, you need to tell it what is the title, what is the description and which image each row should use. These are done, respectively, by setting AspectName, DescriptionAspectName and ImageAspectName.

    You'll also need to increase the RowHeight so that both the title and the description can be seen. Set it to 60 for a first guess.

    Finally, you'll need to set a name for your image when you add it. You then use that name to reference the image you added.

    The demo has all of this stuff on display and in reasonable easy to understand code. This file should exactly how to do what you have asked: https://sourceforge.net/p/objectlistview/code/HEAD/tree/cs/trunk/Demo/TabDescribedTask.cs