Skip navigation

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).

http://cid-2221dc39e0c749a4.skydrive.live.com/embedrowdetail.aspx/WPFSamples/GridViewHelper.cs

Advertisements

One Comment

  1. The link is not working. It gives message “This item appears to be missing.”.

    Can you please re-instate and inform me.

    Thanks and regards,
    Manoj


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: