views:

553

answers:

2

I'm trying to use FluidKits ElementFlow-control in my application, but get an exception in the MeasureOverride method of ElementFlow.

Layout measurement override of element 'FluidKit.Controls.ElementFlow' should not return PositiveInfinity as its DesiredSize, even if Infinity is passed in as available size.

In the sample application following FluidKit everything goes alright. When MeasureOverride gets called, the availableSize-struct is initialized with the bounds of the control, but in my application it comes with INF for both width and height.

I have tried to find whats different between the sample and my app, but both is a window with a grid with a listbox who uses the ElementFlow for ItemsPanel.

I have found others struggling with the same exception, but I have not found any solution to it, other than giving the listbox an explicit size. But I don't want to give it a size, I want the grid to manage its layout.

Any suggestions?

A: 

Any chance you could post some sample code?

I had a similar problem, turned out I had to have the grid as the root element (previously the grid was in a Canvas, I ended up moving it to a user control and everything worked fine).

I ended up throwing it all out... But it should be quite easy to reconstruct. I use the flowcontrol as a layouttemplate for a listbox, and as long as I do not specify an explicit size for the listbox, the error appear.
Vegar
A: 

See the discussion on the FluidKit CodePlex site. The simple answer is to open the ElementFlow code and change the return value in MeasureOverride from availableSize to _viewport.DesiredSize.