• Marc A. Brown

Limitations of the VariableSizedWrapGrid control and a replacement to avoid them [UPDATED]

After spending a few hours over the weekend attempting to get a data-bound VariableSizedWrapGrid to play nicely with text data that, after wrapping, will have variable heights, I discovered that the height for each element gets set to the height of the first element when setting the ItemHeight property to "Auto". I had resigned myself to having to do some code-behind magic to get the effect I wanted and sat down this evening to figure out exactly what I would need to do. However, I found this page that discussed this very issue. As it turns out, this isn't a bug -- it's by design (which is what I figured when I couldn't find any way around it) and in order to get the effect I need, I would need to (somehow) calculate the height of each item (as it would be displayed) and set each item's RowSpan property to a multiple of the height of the first item in the list (or of the value of ItemHeight if not set to "Auto"). In reading to the bottom of the post, one response pointed to the WinRT XAML Toolkit on CodePlex, which contains a port of a number of Silverlight Toolkit controls, including the WrapPanel. WrapPanel behaves in the fashion I need without the need for the code-behind magic I was contemplating.

UPDATE: The Callisto toolkit also contains the WrapPanel control. Because I'm already using Callisto controls in the project, I switched to that version of the control.

0 views0 comments

Recent Posts

See All

Well, here I sit with a second Microsoft app store certification rejection. I'm trying to get a critical fix for my Digital Blasphemy browser app published but Microsoft keeps shooting me down. They h