Monday, February 9, 2009

Inheritance in WPF

Completely new to Windows Presentation Foundation (WPF). It was quite interesting to learn it. During coding I was happened to use inheritance. As usual in any ‘C’ coding style programming language I followed the pattern BaseClass : DerivedClass in my .xaml pages. I was getting build error until I discover the additional add-on code. The code snippet is shown below.


Instead of the Window or UserControl tag, we need to use Src tag followed by the file name (here PageBase, for my PageBase.cs file). To make that file to be recognized we need to specify the namespace too, which is done in xmlns:src property. This piece makes inheritance to happen.

0 comments: