How do I have a UITypeEditor tell the Designer that the component has changed?


K

Ken Dopierala Jr.

Hi,

When I change properties through the property window on my custom control
and then move focus from that property cell VS.Net runs the
GetDesignTimeHtml() method on my designer. When I implement a UITypeEditor,
change the values, then close the editor nothing happens until I switch the
HTML view (which shows the changes) and then switch back to design view
which then shows the new stuff.

I can get to my component through the Context.Instance object in the
EditValue method but I can't figure out how to get a reference to the
designer to call GetDesignTimeHtml(). When the editor closes and I assign
the value to the property of my control I can set a breakpoint where the
property is assigned the new value but I still can't see how to get a
reference to the designer. How can I call GetDesignTimeHtml() or get it to
be called after my control changes due to action taken in a custom
UITypeEditor? Thanks! Ken.
 
Ad

Advertisements

K

Ken Dopierala Jr.

Hi,

With the following code in the Set method of my property that gets updated
from the custom UITypeEditor I can all the UpdateDesignTimeHtml() function:

Dim x As New MenuDesigner
x.Initialize(Me)
x.IsDirty = True
x.UpdateDesignTimeHtml()

I overrode the UpdateDesignTimeHtml() function so I could set a breakpoint
and in it I just call the base classes method. When I call this myself, it
gets hit and runs and still nothing changes in the design screen. However,
I added a bogus property that has no editor. When I change it in the
property window and move focus from it, it calls UpdateDesignTimeHtml() and
the updated control instantly renders. I scoured the Designer object when I
hit the break point in the UpdateDesignTimeHtml() function and everything
seems to be set the same regardless of if I call it or VS.Net does. IsDirty
is set to True, it shows the correct ID of the control it is designing for,
all references appear to be identical. What am I missing here? Thanks!
Ken.
 
Ad

Advertisements

K

Ken Dopierala Jr.

Hi,

It appears that when I call UpdateDesignTimeHtml() directly,
GetDesignTimeHtml() is never called. But when VS.Net calls it, it is
called. What do I need to do to my component to put it in a state where
it'll fire the GetDesign... method when I call the UpdateDesign... method?
I've tried creating a function like this:

Public Sub MarkChange()
Dim c As IComponentChangeService =
DirectCast(GetService(GetType(IComponentChangeService)),
IComponentChangeService)
c.OnComponentChanging(Me, Nothing)
c.OnComponentChanged(Me, Nothing, Nothing, Nothing)
End Sub

Which I call before I call the UpdateDesign... method. However it still
doesn't help. Thanks for any input. Ken.
 

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