Discussion:
Using behavior service in a custom root designer
(too old to reply)
David Husselmann
2006-05-22 00:08:18 UTC
Permalink
Hi everyone,

I'm currently writing a custom root designer for a report designer running
inside VS. While learning about the rest of the designer framework, I
stumbled upon the Windows Forms way of doing smart tags, resize handles and
the like - the Behavior Service.

Unfortunately it seems the behavior service was only meant to work with
Windows Forms; not with any other designers. This is manifested in the
VS.NET designer host not even giving me a reference when I do a
GetService(typeof(BehaviorService)).

My question is whether there is any way to make the behavior service (and
all the other good stuff like adorners, glyphs and behaviors) work with a
custom designer that is not winforms?

Any hints will be greatly appreciated. At this stage I have two options:
either duplicate the entire behavior service framework as it stands in .NET,
or fake a windows forms designer to design my reports in (which is quite
kludgy in my opinion).

Regards
David Husselmann
David Husselmann
2006-05-23 05:06:02 UTC
Permalink
Well, I got around the problem by subclassing the DocumentDesigner class and
staying inside the windows forms architecture - it seems that it's simply
impossible to reuse the behavior mechanisms outside this framework.

Regards,
David Husselmann
N!ls
2007-10-26 11:47:42 UTC
Permalink
As per my uderstanding of the DesignTimeArch, you can have a BehaviourService for any Designer (even if its not of typeof FormDesigner).

In your customDesigner class while initializing u need to add add adorners and glyphs.
That's all...
See this sample code:

class myControlDesigner: ControlDesigner
{
public override void Initialize(IComponent component)
{
base.Initialize(component);
adorner = new Adorner();
adorner.Glyphs.Add(new MyCustomGlyph(BehaviorService, this.Control));
this.BehaviorService.Adorners.Add(adorner);
}
}
. and you are done... It will do the functionality mentioned in your MyCustomGlyph class on whichever control this Designer applied to.
Ping me back for any trouble...
r[.]nilesh[@]gmail[.]co

From http://www.developmentnow.com/g/32_2006_5_0_0_759183/Using-behavior-service-in-a-custom-root-designer.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com

Loading...