Multiple inheritance problem in C#

c#, inheritance, wpf

Solution

One solution that may work for you is to create an interface instead, and put your implementation in extension methods.

Problem

I am in a situation where i need to use multiple inheritance in C# with WPF. I am making a control lets say Control-1 that is derived from combobox control. I added some dependency properties as well as methods to the my control Control-1 class. Most of the properties and methods(infact the same implementation of properties and methods) in my control-1 can also be used in another control called Control-2 but that control should not be derived from combobox control (as is the case with Control-1). I want to seperate the common dependency properties and methods in another class but seperating it in another class require me to derive my control class (control-1) from combobox control and the common class containing properties and methods. Is there a design that can solve my problem. Note: The question is about C# using the WPF framework's dependency properties, which require static members and not just on C# in general. Related How to reuse code when multiple inheritance is not an option? Multiple Inheritance in C# How To Implement Shared Behavior Between Classes (Without Multiple Inheritance Of Course) in C# What are some good alternatives to multiple-inheritance in .NET?

Original source

Related problems