Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Trouble getting designer for a component

Trouble getting designer for a component

Scheduled Pinned Locked Moved C#
helpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Simon_uk
    wrote on last edited by
    #1

    Good morning, I have a custom (windows) user control, which is my own designer host implementation. It all works fine when I run the control in a windows app. I have toolbox, property window, etc. However, I require this form to be implemented in a web page. I am using the <OBJECT> tag to achieve this, and the control is displayed correctly. It all works as per the windows app, with one small problem! In my implementation of IContainer.Add, I call IDesigner designer = TypeDescriptor.CreateDesigner(component, typeof(IDesigner)); This works fine when hosted in the windows app. In the web however, it returns null. ARGH! If I remove the [Designer] attribute from the control, its ok. I've tried specifying the designer type using typeof and as a fully qualified string. Also tried adding the second parameter (BaseDesignerType) as typeof(IDesigner) and that hasn't helped either?? Apologies for the long post :sigh: its driving me mad!! Anyone have any ideas? Thanks in advance, Simon.

    H 1 Reply Last reply
    0
    • S Simon_uk

      Good morning, I have a custom (windows) user control, which is my own designer host implementation. It all works fine when I run the control in a windows app. I have toolbox, property window, etc. However, I require this form to be implemented in a web page. I am using the <OBJECT> tag to achieve this, and the control is displayed correctly. It all works as per the windows app, with one small problem! In my implementation of IContainer.Add, I call IDesigner designer = TypeDescriptor.CreateDesigner(component, typeof(IDesigner)); This works fine when hosted in the windows app. In the web however, it returns null. ARGH! If I remove the [Designer] attribute from the control, its ok. I've tried specifying the designer type using typeof and as a fully qualified string. Also tried adding the second parameter (BaseDesignerType) as typeof(IDesigner) and that hasn't helped either?? Apologies for the long post :sigh: its driving me mad!! Anyone have any ideas? Thanks in advance, Simon.

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      When you host a control in IE, the playing field changes. First of all, is the designer in the same assembly as your control, or a separate assembly? What membership condition identities your assembly and what permission set is granted to it based on matching evidence? Are you simply using FullTrust?

      Microsoft MVP, Visual C# My Articles

      S 1 Reply Last reply
      0
      • H Heath Stewart

        When you host a control in IE, the playing field changes. First of all, is the designer in the same assembly as your control, or a separate assembly? What membership condition identities your assembly and what permission set is granted to it based on matching evidence? Are you simply using FullTrust?

        Microsoft MVP, Visual C# My Articles

        S Offline
        S Offline
        Simon_uk
        wrote on last edited by
        #3

        Hi, Thanks for your information. Yes, the designer is in the same assembly as the control it is designing. This assembly is seperate to the assembly containing the designer host, but as the designer host can 'see' the control, I'm sure it must have access to the designer as well. Both assemblies have full trust (they will only be used on intranet, and security protocols are already in use in other parts of the app, so it's not really a security risk). I have now resolved this problem. I used Reflector to see what TypeDescriptor.CreateDesigner(IComponent comp, Type designerBaseType) was doing, and copied the code to a local method so I could debug it. If you are interested, the problem appeared to be that Type.GetType(designerBaseType) was returning null. (the designerBaseType parameter was hard-coded to IDesigner). I got around this problem by changing all the controls (no, users will never add their own controls to this designer!) to use the constructor of the DesignerAttribute that accepts two parameters, and set the second one to the same type as the first. When the component is then added to the design form, I get the DesignerAttribute for that type, and call TypeDescriptor.CreateDesigner with the type specified in the second parameter of the attribute. OMG :omg: I don't really understand what I just wrote! :) - it you are really interested, feel free to email me and I'll try to explain in more detail!!! Thanks for your reply. Simon. PS: Is Reflector the most AMAZING tool for .NET development?!?!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups