我想为我的小应用程序尝试一个MVC设计.
我有一个普通的Csharp类ViewBase,它扩展了UserControl.这是一个.cs文件.
我有多个类,我想扩展ViewBase.这些是实际的UserControls,所以它们有一个.cs文件和.xaml文件的代码.
但是,CSharp告诉我,对于这些类,它们的基类“与其他部分不同”.
是我想做的可能吗?我究竟做错了什么?
以下是相关代码:
// This gives the error in question and ViewBase is underlined // "Base class of LoginView differs from declared in other parts" public partial class LoginView : ViewBase { public LoginView(Shell shell,ControllerBase controller) : base(shell,controller) { InitializeComponent(); } } // This one is a single .cs file public abstract class ViewBase : UserControl { public Shell Shell { get; set; } public ControllerBase Controller { get; set; } protected ViewBase(Shell shell,ControllerBase controller) { Shell = shell; Controller = controller; } }