• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

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?
0
andrewjb
Asked:
andrewjb
  • 3
  • 3
1 Solution
 
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.
0
 
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?
0
 
AlexFMCommented:
You can only draw control at design time. It doesn't respond to mouse messages.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
andrewjbAuthor Commented:
That can't be true - the Infragistics component set have buttons that are active at design time :-)
0
 
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.
0
 
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.

0
 
GranModCommented:
Closed, 250 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now