views:

263

answers:

1

Context: Visual Studio : C# : Windows Forms : design time : using a custom UserControl that implements Smart Tags which you have placed in a container (Window or Panel) on a Form in your current project : .NET FrameWork >= 3.5

Hi,

Pease keep in mind everything I am describing is happening at Design Time.

I am clear how to create a Smart Tag for a UserControl in code, set it up with an ActionList, write methods to be triggered when the design-time consumer of the UserControl makes a choice on the menu presented by the Smart Tag, and I am clear you can make a method invoked this way present some custom ui you have created to set properties on your current instance of the UserControl in your project.

What I'm curious about is the "scope" of what you can do from within a method invoked in this way from a Smart Tag in this way:

  1. For example, can you: from within the UserControl's code: get a reference to your current design-time parent object?

  2. If you can get that reference, then: can you "traverse up" from the immediate parent to "see" if there are other parent objects: i.e., "walk" up the object graph of the whole project until you reach the outermost container (i.e., the Form)?

  3. If you are able to do #1 and #2: can you then "wander through" or recursively parse the entire object graph of the current project?

    a. if you can't do #3: can you at least "observe" other objects within the same
    container where your UserControl is sited?

  4. if you can do #3. or #3.a: can you make changes in any property of some other control within or outside of your UserControl's parent container?

To sum it up: I'm curious what you can ... and can't ... do from within a method triggered by a menu choice in a Smart Tag on a custom control you've built that has now been "instanced" at design time.

I'm also interested in being able to rigorously understand the scope of what's doable from the viewpoint of what can be done as well a what can be observed (it seeming reasonable to me that some "barrier" might be there for security reasons on a UserControl being able to make changes on objects outside its own domain: else you can imagine a "nightmare UserControl" :) ).

Any pointers to resources, or hints, will be most appreciated.

Thanks, Bill

A: 

good questions Bill, did you get any feedback? I am at the same stage in my research.

TriSys