Laurent Bugnion (a fellow WPF Disciple) just wrote a post showing one way to add MaxWidth capabilities to the WPF GridView. William Kempf (another disciple whom I had the pleasure of meeting when I gave my presentation at Indy Code Camp), suggested that Laurent use an attached property to allow the feature to be XAMLized.
I thought it would be a good idea. So I fired up VS and wrote a little bit of code. If you’ve read my posts on using the remora pattern then you know the gist of the setup (if not go see them here). Laurent jumped through a few hoops to hook into the drag event of the GridViewColumnHeader resize thumb control. I found out that GridViewColumn implements INotifyPropertyChanged so on a whim decided to check if I can catch a Property changed event when the Width is changed. Lo and behold I could. So I checked if I could do a poor man’s CoerceValue and surely enough I was able to do that as well. I couldn’t think of a better place to put it, so I checked the code into the WPF Toolbelt (along with a few other changes). This makes the first check-in since September of last year. I just reorganized some namespaces and stuff…it took me a while to get reacquainted with the code. But I will be performing more work on it in a while. Download the code from Skydrive (only have the MaxWidth attached property now…MinWidth isn’t much harder though).