public _ViewBase() { StackPanel sp = new StackPanel(); Button b = new Button(); b.Content = "Click me"; sp.Children.Add(b); this.Content = sp; }But I agree with John - from a WPF POV this is very unlikely to be the right approach. Are you using MVVM for this app?
>>>public abstract partial class _ViewBase : UserControl >>>{ >>> public _ViewBase() >>> { >>> InitializeComponent(); >>> } >>> >>> public abstract void Add(); >>> public abstract void Edit(); >>> public abstract void Remove(); >>> public abstract void Save(); >>>} >>>>>>
Partial declarations of 'UserView' must not specify different base classes>>>
>>>"_ViewBase" cannot be the root of a XAML file because it was defined using XAML. >>>>>>
namespace Junk >>{ >> public class _ViewBase : UserControl >> { >> public void Add() { } >> public void Edit() { } >> public void Remove() { } >> public void Save() { } >> } >>}To use this in as a subclassed control:
<b:_ViewBase x:Class="Junk.MyViewBase" >> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" >> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >> xmlns:b="clr-namespace:Junk"> >></b:_ViewBase>with C#:
namespace Junk >>{ >> public partial class MyViewBase : _ViewBase >> { >> public MyViewBase() >> { >> InitializeComponent(); >> } >> } >>}>>The first error you got would have been because you didn't sync the base class name between the C# and XAML in the derived class and the second because you tried to create your base class using a XAML component....