none
Adding a type from external assemblies to ToolboxControl RRS feed

  • Question

  • I am trying to do something like this:

     

       
      ToolboxControl ctrl = new ToolboxControl();
      Assembly assembly = Assembly.LoadFile(file);
      var category = new ToolboxCategory(assembly.GetName().Name);
      foreach (Type t in assembly.GetTypes())
      {
        var wrapper = new ToolboxItemWrapper(t, t.Name);
        category.Add(wrapper);
      }
      ctrl.Categories.Add(category);
    

    i.e. adding ToolboxItemWrappers for each type found in an assembly. However the last line throws the following exception (see image)

    http://img41.imageshack.us/img41/2261/7xvqv.png

    All dependencies of the external assembly are also referenced in the main (WPF) application. So what's wrong here and how to fix it?

     

    • Edited by Louis Rhys Tuesday, January 4, 2011 3:04 PM
    • Moved by Yves.Z Wednesday, January 5, 2011 7:44 AM Workflow related (From:Windows Presentation Foundation (WPF))
    Tuesday, January 4, 2011 6:18 AM

All replies