Posted by: Zeeshan Amjad | January 27, 2010

Non extensibility of WPF

WPF is very flexible design we can customized almost everything thing in this library. But there is one thing which even WPF which we can’t optimized.

Let’s understand one basic concept to understand this. We know that we can create a non inheritable, (or sealed or final) class in C# very easily. There are few techniques to simulate the same concept in C++ using virtual inheritance.

But C# has concept of final method. It means that we can’t override that method. There is no equivalent of this in C++. There is no way we can create a final method in C++, the closet approach is either make function private or non virtual.

Here is a simple concept to demonstrate the concept of final method in C#.

  1: public class Base
  2: {
  3:     public sealed void Function()
  4:     {
  5:         Console.WriteLine("Base.Function");
  6:     }
  7: }
  9: public class Child : Base
 10: {
 11:     override void Function()
 12:     {
 13:         Console.WriteLine("Child.Function");
 14:     }
 15: }

This program has compilation error, because “Function” is declared final and we can’t override it.

We already studied about markup extension here and here. We already know that in markup extension we have to overload the “ProvideValue” method.

We also studied that binding class is inherited by bindingbase, which is a child class of MarkupExtension as defined by this class diagram.



But “ProvideValue” is a sealed method in binding base class. It means we can’t override this. Therefore even if we inherit class from BindingBase class, we can’t override its functionality.

Although almost everything is customized in WPF, but still we can’t extend the functionality of data binding class in WPF.



  1. […] we can’t access that class directly from our code, at least not easily. We already discuss one limitation of WPF extensibility and this is one more limitation of WPF […]

  2. […] quickest method to do this is by inheriting one class from the Binding class. But we already saw that “ProvideValue” method of binding class is sealed so we cant override it. Here we are going […]

Leave a Reply

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

You are commenting using your 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: