How to add images as subitems in ListView?
https://stackoverflow.com/questions/931597
Question
I am currently working on a standard windows mobile application. It is required that we use a ListView, but with images in the sub items.
We need a List View with 3 columns and three rows. I want to show 9 icons on form.
How to add images as subitems in ListView?
I can use picture box but i don't have any event to navigate from one image to another image.
How can I handle it?
Thanks
No correct solution
OTHER TIPS
There is no native support for adding images as subitems in the ListView. If you know that there will always be exactly 3x3 images, why use a ListView? You can simply lay out 9 PictureBox controls on the form and load the icons into them.
It might be worth checking out this article. Although it's written for the full .NET Framework, it might also work for the Compact Framework (I have not tested it myself, but NMCUSTOMDRAW seems to be supported by Win CE).
The only way to do this in a standard ListView use owner-drawing.
Set the OwnerDraw
property of the ListView to true
, handle the DrawColumnHeader
and DrawItem
events and set e.Handled
to true
, and handle the DrawSubItem
event and draw the correct images.
EDIT: The .Net Compact Framework does not support owner drawing, so this technique cannot be used.
http://bytes.com/topic/visual-basic-net/answers/481668-listview-subitems-image-index Read out this article, it will help you.