1

I add an Usercontrol base class

my Base Class

 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;
        }
    }

but the design does not shown

enter image description here

24sharon
  • 1,859
  • 7
  • 40
  • 65

1 Answers1

1

Browsing around some of the other questions, I found some of the reasons this can happen

Q1 WPF Designer “Could not create an instance of type”

  1. Suround the code in your constructor with this:
if(!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
{
   //code producing exception         
}
  1. The base class is of the abstract type
  2. An exception is thrown in your constructor while loading the custom control. This goes back to 1.

Please share the stacktrace for us to help more.

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61