WPF: Custom Controls
January 16th, 2008 . by TobiasLet me save you some time ;).
I had a hard time of finding all the information I needed to create a really usable wpf custom control (user defined templates etc.). Looks like Charles Petzold had to go the same way and was keen enough to write an article for MSDN mag.
So if you want to go the custom control route, read the article at http://msdn.microsoft.com/msdnmag/issues/08/01/Foundations/default.aspx before you start. It's quite easy once you got all the information in place.
Another interesting links, even if you are looking for tipps on how to integrate your new control nicely into all the editors out there (VS 2008, Blend, etc.): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2125195&SiteID=1
BTW: Never set
DataContext = this;
within your custom control just because your Bindings within the generic.xaml template doesn't work. Take the proper approach:
{Binding RelativeSource={RelativeSource TemplatedParent},Path=XY}
(to be continued...)
