Rudi Grobler: Keeping track of open windows in WPF via an Attached Property
Rudi and his Attached Property
Rudi considered the following options:
- binding to a collection, Application.Windows (but it was not an ObservableCollection)
- building a special subclass of Window, but that requires people to use a different item template in VS to create new windows.
- finally, attached properties...which allow decorating a normal WPF window to make it work...
Check out the cool feature he was trying to implement that Lawson Smart Client had done...and how he did it: http://dotnet.org.za/rudi/archive/2008/03/27/keeping-track-of-open-windows-in-wpf.aspx
John's Favorite Feature?
In a meeting this week, John Gossman, an Architect for Blend v1 and now WPF/Silverlight, had said that Attached Properties are one of his favorite features in WPF. (I love working with John because his experience building Blend brings great experience to the table. I know a ton about WPF, having lived it since 2001, but working inside WPF vs working with WPF give you different sets of knowledge.)
Attached or Attachable
In the [MS-XAML] and [MS-WPFXV] specs we just published, we started calling this attachable properties. That is because the perspective has changed when we are talking about what a type provides (attachable properties) vs what an instance has had set on it (attached properties).
- So I say, Canvas provides several attachable properties: Top, Left, etc.
- I also say that the button has the Canvas.Top attached property set on it.
Thoughts?