Different behaviour design-time vs run-time

Could someone point me in the right direction, perchance..?

How can I have a control that behaves slightly differently in design mode cf run-time mode.

I'd like to:

a) Render it slightly differently
b) Have some contained controls 'active' at design time.


For example, the Infragistics 'Grid' control has a button visible in design mode that's not there at runtime. I can click that button within the IDE to open up a setup form.. How's that functionality achieved?
LVL 12
andrewjbAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
Use ISite.DesignMode property for this:

if ( Site.DesignMode )
{
    // Control site is is designe mode
}
else
{
    // run time
}

Notice that not all functions of control are called at design time. Functions which are called are paint handler and functions responsible for persistence.
andrewjbAuthor Commented:
I take it that lets me render differently..

But how do I make, for example, a button on a control 'active' at design time? If I simply shove a button on a usercontrol it doesn't respond, does it?
AlexFMCommented:
You can only draw control at design time. It doesn't respond to mouse messages.
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

andrewjbAuthor Commented:
That can't be true - the Infragistics component set have buttons that are active at design time :-)
AlexFMCommented:
I tested this one more time - it doesn't work by such way. I guess they have child control inside of Infragistics component  - in this case it can handle mouse messages.
andrewjbAuthor Commented:
I've now found out how to do it... You need to implement a ControlDesigner, which wraps around your actual control and interacts with the IDE at design time.

GranModCommented:
Closed, 250 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.