I wanted to use a common base class for a set of UserControls in my WPF application, but when I changed the class’s ancestor in the code file and compiled I would get the error
“Partial declarations of must not specify different base classes”
This is because when you compile a WPF application Visual Studio generates a partial class in a code-behind file automatically, the base type specified is always “UserControl”. To solve this problem change your XAML from this
1: <UserControl
2: x:Class="MyApp.MyControl"
3: />
To this
1: <local:SomeBaseTypeYouWantToUse
2: x:Class="MyApp.MyControl"
3: xmlns:local="clr-namespace:NameSpace.To.Your.BaseClass"
4: />