© Marc A. Brown. All rights reserved.

  • White Facebook Icon
  • White Instagram Icon
  • White Twitter Icon

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

May 6, 2013

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.

Share on Facebook
Share on Twitter
Please reload

Recent Posts

June 17, 2017

Please reload

  • White Facebook Icon
  • White Twitter Icon
  • White Instagram Icon
Follow Us
RSS Feed