Lately I’ve been making a point of being a little more organized about how I track reusable code.  When I’m working with a client and come across something that is worth keeping or sharing I’ll usually ask if I can do it on my own time so I can keep or share it.  So far everyone’s been very amenable to that idea.  I think it’s a win-win: free code for everyone (future me, you, current clients and future clients).

So here are the first fruits of that, a few “to share” Panels (for WPF and Silverlight) that I’ve been meaning to blog about for a while.  They’re pretty simple, but have proven to be a really handy part of my arsenal.

ColumnWrapPanel (WPF or Silverlight)

Download it here. This is the one I’m most excited about.  It’s a smarter version of a WrapPanel that tries to enforce a little more order on how it arranges its items.  It does this by maintaining a sense of columns and row height as it places the items and then snaps the items to those columns and rows.  Its also smart enough to place items into “empty” spaces that get created by extra tall or extra short items in the panel.  Think of it as WrapPanel without the jaggies.

Here’s some XAML:

<c:ColumnWrapPanel MinColumnWidth="200" RowHeightIncrement="50">
  <Rectangle c:ColumnWrapPanel.ColumnSpan="3" Height="100" Fill</s
Leave a Reply

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