Search code examples
wpfinheritanceuser-controls

Inheriting from a UserControl in WPF


I am fairly new to WPF and I am having a problem with inheriting from a user control.

I created a User Control and now I need to inherit from that control and add some more functionality.

Has anyone does this sort of thing before? Any help would be greatly appreciated.

Thank you


Solution

  • AFAIK you cannot inherit the xaml, you can only inherit the code behind.

    We recently encountered the same problem on our project. The way we ended up solving our problem was to create a usercontrol and adding it to the "child" usercontrol.

    If that doesnt work/help take a look at this: https://web.archive.org/web/20200815091447/http://geekswithblogs.net/lbugnion/archive/2007/03/02/107747.aspx[1]