tags:

views:

32

answers:

1

Hi, does anyone have a functioning virtualising WrapPanel I can use in a WPF application?

I have downloaded and tried the implementation at http://virtualwrappanel.codeplex.com/. However, I get the following exception:

"Layout measurement override of element 'MyNamespace.VirtualizingWrapPanel' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size."

This is when trying to apply the wrappanel to a ListBox

+1  A: 

This is probably a bug that you might be able to fix yourself. Look for the MeasureOverride method. It always seem to return the availableSize wich was passed to the method. As the exception states you must not return availableSize when it contains double.PositiveInfinity. So try this:

if(availableSize.Width == double.PositiveInfinity || availableSize.Height == double.PositiveInfinity)
{
    return Size.Empty;
}

// all the measureoverride code comes here

return availableSize;

I haven't looked at the implementation in details. But who knows, you might be able to get a away with this if the panel doesn't save state between MeasureOverride and ArrangeOverride (wich it shouldn't if it is well implemented).

bitbonk
Thanks bitbonk, I have made this change and fixed the exception, but the performance seems to be much worse than the normal WrapPanel. Are there any commercial virtualising wrappanels available with good performance?
devdigital