Thank you for your question.
Yes, there is a way to loop through the visual items, but generally, this is not the correct approach of setting their properties. Due to the virtualization mechanism of RadListView
, the visual items are reused for displaying different data items. In addition, not all data items have a visual one at a given moment, only the ones that are in the visible area of the control.
I am not sure what the exact scenario is, but you might find the VisualItemFormatting
event useful. You can also use the following method to get the visual item of a certain data item:
This method will return null
if the data item is not in the visible area of the control.
You can use the following approach to loop through all the visual items:
CustomListViewVisualItem visualItem = element
Again, please note that this is not a good approach since those visual items change their data items very often when you are scrolling up and down.
There are other approaches as well that involve overriding some of the methods of the custom visual item class, but I cannot suggest you one since I am not aware of the exact use case. If you describe your requirements in detail, I can suggest you which approach to use and also provide you with sample source code.
Do not hesitate to write back if you need further assistance.
the Telerik team
of RadControls for WinForms is available for download
(see what's new