C# Wpf usercontrol base,无法创建实例
我添加了一个Usercontrol基类 我的基层C# Wpf usercontrol base,无法创建实例,c#,wpf,C#,Wpf,我添加了一个Usercontrol基类 我的基层 public class UserControlBase : UserControl { protected IAppLogic app; public MainWindow CurrentWindow{ get{ return (App.Current.MainWindow as MainWindow); }
public class UserControlBase : UserControl
{
protected IAppLogic app;
public MainWindow CurrentWindow{
get{
return (App.Current.MainWindow as MainWindow);
}
}
public UserControlBase()
{
var _app = IoC.Kernel.Get<IAppLogic>();
this.app = _app;
}
public void MainNavigate(Pages.PageBase p)
{
CurrentWindow.MainFrame.Content = p;
}
}
公共类UserControlBase:UserControl
{
受保护的IAppLogic应用程序;
公共主窗口当前窗口{
得到{
返回(App.Current.MainWindow作为主窗口);
}
}
公共用户控制库()
{
var_app=IoC.Kernel.Get();
this.app=\u app;
}
public void MainNavigate(Pages.PageBase p)
{
CurrentWindow.MainFrame.Content=p;
}
}
但是设计没有显示出来
浏览其他一些问题,我发现了可能发生这种情况的一些原因 Q1
if(!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
{
//code producing exception
}