Lately, I have been trying to be a bit tidier about tracking reusable code. While I am working with any client, if I come across anything that seems worth sharing or keeping, I ask them for their permission to be able to do so in my own time. Fortunately, everyone has been very accommodating to this idea of mine. The code is surely a win-win for everyone – for me, for you, and for my future and current clients.

And for this reason, here I share with you the first few fruits.  These are a couple of “to share” Panels for Silverlight and WPF. I wanted to blog about them for some time, but couldn’t find time to do so, but here I am finally sharing them with you. They may seem very plain and simple but are super useful.

ColumnWrapPanel (Silverlight or WPF)

You may download it at this link. This one is my favorite. If you are familiar with WrapPanel, this is a smarter version of WrapPanel. We can have a bit more order and arrangement with the items. The way it does that is by keeping a sense of rows and column height as it goes on to place the items. Another way it proves itself to be smarter than WrapPanel is that it doesn’t fail to utilize the “empty” spaces and places items in these spaces too. Well from where do these spaces come anyway, you may ask? Well, these spaces are created because of extra short or extra tall items in the panel. In other words, this is WrapPanel but without all the jaggies.

Here is some XAML:

<c:ColumnWrapPanel MinColumnWidth=”200″ RowHeightIncrement=”50″>

<Rectangle c:ColumnWrapPanel.ColumnSpan=”3″ Height=”100″ Fill</s

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *