UI Cues not updating in designer

G

Guest

Got a custom container control that contains other custom subcontrols that
have a custom designer. The subcontrol's designer has a couple verbs that
fire off events that changes the order of that subcontrol in the parent
custom control. It's another version of the collapsible panel bar, where in
designer you can right click on a panel and move it up or down in the panel
bar. The problem I'm having is that when I move a panel, the UI cues don't
get updated. The panels will move, but the selection highlight will not move
with the panel. It appears that a different control is selected than
actually is. Clicking on a different panel will update the cues (except when
you click on the control that is highlighted incorrectly -- the cues already
indicate it is selected, so no change appears to have been made). I can't
find any information on how to refresh the cues. I've tried Invalidate and
Refresh in the custom container control, but they don't work. TIA.
 
G

Guest

The answer was to grab aholt of the IComponentChangeService and pass it the
control that changed. There is probably a better way to do this (a la best
practices), but as I am unable to find good, detailed information on design
time goings-on, this will have to do for now (and it friggin works, which is
a big plus).

MyControl foo = (MyControl)this.Control;
MyControlContainer bar = (MyControlContainer )foo.Parent;
bar.MoveDown(foo);
// Notify the IDE that this component has changed
IComponentChangeService c =
(IComponentChangeService)GetService(typeof(IComponentChangeService));
c.OnComponentChanged(foo, null, null, null);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top