When using a RadListBox with a VirtualizingWrapPanel as ItemsPanel and the ScrollUnit is set to Pixel, the previously selected item stays like an overlay that can be interacted with if the ItemWidth and ItemHeight are changed.
The attached files contain a demo application, which is a minimal sample to reproduce the problem. Due to the file upload size limitation, the referenced Telerik DLLs for the sample project are not contained.
A RadListBox with a VirtualizingWrapPanel as ItemsPanel is used to display a collection of strings. The ScrollUnit is set to Pixel. The size of the items can be adjusted with a button that toggles these sizes: Small, Medium and Large. The current size is displayed in a TextBlock. The sizes are defined as an enum and mapped to ItemWidth and ItemHeight in a Style.
The previously selected item in its original size still exists, is selected, immovable and clickable.
All items are displayed using the new size and the corresponding item is selected. There are no duplicate items or leftover items with the previous size.
Since I updated to the most recent version of your controls, I can see that many of my users get a DivideByZero exception.
I have not made any changes at all to my code, and unfortunately I cannot reproduce it.
It's reported a couple of times per day though via our uncaught exception tracker.
The callstack is:
Is this a known bug? As you can see it's thrown from your components.
This behavior is reproducible when the ItemHeight and ItemWidth properties are changed runtime. When thеse properties are changing, and an item is removed, its container is still presenting in the UI, which leads to an empty container.
I you add an item and remove an item from the items source of the panel's host, empty spaces are drawn.
This is reproducible only when using the .NET 4.5 version of Telerik UI for WPF.
To resolve this, avoid using the VirtualizingWrapPanel, or use the .NET 4 version of the Telerik dlls.
This is similar to the native VirtualizingStackPanel which has a CleanUpVirtualizedItem attached event. https://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingstackpanel.cleanupvirtualizeditem(v=vs.110).aspx
Currently, the panel will create containers for the first item that should be shown before the viewport start and the last item that should be shown after the viewport. Here we talk about containers outside of the viewport. This is defined in the implementation of the panel and it cannot be changed. Allow setting the number of visual items that can be generated out of the viewport. Or maybe pixel size. Similar to the attached properties of VirtualizingPanel (CacheLength and CacheLengthUnit). May be we can use them as well.(https://msdn.microsoft.com/en-us/library/system.windows.controls.virtualizingpanel.cachelength(v=vs.110).aspx) Note: The cache is the amount of space above or below the viewport in which items are not virtualized.
Setting HorizontalAlignment to VirtualizingWrapPanel is not properly reflected in the UI.