next best geek
this blog cannot be explained in a few words

WPF: Custom Controls

January 16th, 2008 . by Tobias

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


2 Responses to “WPF: Custom Controls”

  1. comment number 1 by: Assissotom

    Yes. Very good site! worth to visit!

  2. comment number 2 by: ivana

    After reading the sites, seem like the free WPF Gauge library I downloaded from http://www.nextwavesoft.com
    is not support the defined template as mentioned…

Leave a Reply

You must be logged in to post a comment.