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

Discussion in 'ASP .Net' started by Ken Dopierala Jr., May 13, 2005.

  1. 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

    ***Follow Up:

    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.IsDirty = True

    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?

    ***2nd Follow Up:

    It appears that when I call UpdateDesignTimeHtml() directly,
    GetDesignTimeHtml() is never called. But when VS.Net calls it after
    editing a property in the property window, 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 =
    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.
    Ken Dopierala Jr., May 13, 2005
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    Manish Pandit
    Sep 16, 2007
  2. Martin
  3. WALDO

    Override UITypeEditor on class

    WALDO, Oct 19, 2004, in forum: ASP .Net Building Controls
    Oct 20, 2004
  4. Ken Dopierala Jr.

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

    Ken Dopierala Jr., May 13, 2005, in forum: ASP .Net Building Controls
    Ken Dopierala Jr.
    May 13, 2005
  5. crazyhorse

    server control serialization problem with UiTypeEditor

    crazyhorse, May 23, 2005, in forum: ASP .Net Building Controls
    May 23, 2005

Share This Page