Issue with RadListView when height is arbitrary

1 Answer 102 Views
ListView
Jake
Top achievements
Rank 1
Jake asked on 21 Jul 2021, 01:34 AM | edited on 21 Jul 2021, 04:39 AM

Basically, I've created a custom list view item, there is no issues by default, but when I add an element to the item's element, when you scroll the item out of bounds it will add the element that was in the intended element into another element and remove it from the original element it was added to. How can I fix this from happening?

EDIT: This happens when item height is NOT arbitrary too.

 

EDIT 2: I have messed around, now I am no longer adding any elements (as a test), all I am doing is changing the background color of the element, when the item goes out of bounds another item in another expanded group will be the same background color and the original item will lose the background color. There is no way for me to fix this from what I can tell.

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Jul 2021, 08:48 AM
Hello, Jake,
 
According to the provided information, it seems that you are using a custom visual item in RadListView. However, it is not clear what is the exact implementation that you have. Could you please elaborate?

Please have in mind that the visual item elements are created only for the currently visible items and they are being reused during operations like scrolling. Hence, in order to avoid applying the custom style to other visual elements, all of the applied settings should be reset for the rest of the items. The following help article demonstrates how to customize the items and resets the visual settings:
https://docs.telerik.com/devtools/winforms/controls/listview/customizing-appearance/formatting-items 

As to the custom element that goes to other undesired items, you can show or hide the custom element only for specific items. This should be done in the SynchronizeProperties of the SimpleListViewVisualItem/IconListViewVisualItem for ListView/IconsView and the Synchronize method of the DetailListViewDataCellElement for DetailsView. The following article demonstrates sample approaches how to create custom items and synchronize the displayed data in the respective items:

https://docs.telerik.com/devtools/winforms/controls/listview/custom-items 

In case you are still experiencing any further difficulties, it would be greatly appreciated if you can provide a full code snippet for replicating the undesired behavior. Thus, we would be able to make an adequate analysis of the precise case and provide further assistance. Thank you. 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Jake
Top achievements
Rank 1
commented on 21 Jul 2021, 06:05 PM | edited

I am doing this in the SynchronizeProperties method in a class derived from the SimpleListViewVisualItem. What it does is, in the formatting method all items get a an additional VisualElement that is 1 x 1 and put in top left at (0,0) then inside of there I add a RadWaitingBarElement which is the size of the SimpleListViewVisualItem, the waiting bar is set to ClipDrawing to false, this is to trick the listview into not adjusting the visual item size so that it can be same size as the VisualItem but without making the VisualItem bigger. When the user clicks the list view item it toggles a boolean property called Waiting, in the SynchronizeProperties method it checks if it's true or false, if true then the dashes will be colored, if false the dash colors will be transparent. I am still having the issue though, even though in essence all items have the element and all elements are the same size and never hidden nor collapsed, so it doesnt make sense that it would be causing such issues.
Dess | Tech Support Engineer, Principal
Telerik team
commented on 22 Jul 2021, 09:41 AM

Hello, Jake,
 
Could you please share with us the complete implementation of the custom SimpleListViewVisualItem and how the RadListView control is populated with data? Thus, we would be able to setup a sample project and investigate the precise case on our end.

It would be greatly appreciated if you can share some screenshots of the obtained and expected result. Thank you in advance for your cooperation.

I am looking forward to your reply.
Jake
Top achievements
Rank 1
commented on 22 Jul 2021, 05:42 PM | edited

Yes, in just a moment. I've narrowed it down some more. When you remove the SimpleListViewVisualItem from the SimpleListViewContainer, the element's of the removed items are being given to the SimpleListViewVisualItem with the lowest index that is visible. Because of the way the scroll works, if I jump down to the bottom then it will load the last open SimpleListViewVisualItem into the SimpleListViewContainer first, causing that bottom item (or the first loaded item) to have the elements. I could maybe get around this by rewriting the SimpleListViewContainer to fix how it manages loaded and unloaded items.
Dess | Tech Support Engineer, Principal
Telerik team
commented on 23 Jul 2021, 09:38 AM

Hi, Jake,

I would like to pay attention once again to the fact that the visual item elements are created only for the currently visible items and they are being reused during operations like scrolling. That is why the custom elements should be synchronized according to the data item that is currently associated with this visual item.

However, without replicating the issue locally, it would not be easy to determine what exactly causes this behavior. We can make only conjectures. That is why I would kindly ask you to provide a complete code snippet of the SimpleListViewVisualItem that you have and how the RadListView is populated with data. Thus, we would be able to make a sample project on our end, investigate the precise case and provide further assistance.

Thank you in advance for your understanding and cooperation. I am looking forward to the code sample.

Tags
ListView
Asked by
Jake
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or