Designer Property Serialization -- Sycning inner properties to designer property window

Discussion in 'ASP .Net Web Controls' started by Alexander Higgins, Jul 21, 2007.

  1. Hi,

    I am just getting started developing custom user controls, and I am
    having issues keep the inner properties of nested controls in sync
    with the properties in the designer window. When I change a property
    of a nested control in the properties window, the designer does not
    automatically redraw itself. If I switch to HTML Mode and then return
    to design mode, the control is redrawn. But If I switch back to HTML
    Mode the inner properties are not updated.

    However, If I change a property of my custom control or the font-bold
    property of the nested control in the design window, the nested
    control is refreshed and the inner properties are correctly updated.
    How do I keep the two in sync? Am I missing something here? Do I
    need to implement a TypeConverter and set NotifyParentProperty(True)
    to keep the designer in sync with the properties window. If I do, how
    can I implement one for web controls as I will have several controls
    and do not feel like coding a wrapper for every property of every
    control on the page. Or, is there some why to manually fire the event
    that is raised when the nested control's font-bold is changed in the
    properties window.

    Also, what is the difference between refresh.repaint and refresh.all.
    Does one only redraw the control on the designer while the other
    recreates the controls properties and then redraws the control on the
    designer?

    Here is my code in the simplest form. Thanks for the help in
    advance...

    Imports System.ComponentModel
    Imports System.Web.UI
    Imports System.Web.UI.WebControls
    <Assembly: TagPrefix("Editor", "cms")>
    <ParseChildren(True), Designer("System.Web.UI.Design.ControlDesigner,
    System.Design"), DefaultProperty("Text"), ToolboxData("<cms:Editor
    runat=server></cms:Editor>"),
    RefreshProperties(RefreshProperties.Repaint)> Public Class Editor
    Inherits System.Web.UI.WebControls.WebControl
    Implements INamingContainer

    Dim _text As String

    <Bindable(True), Category("Appearance"), DefaultValue("")>
    Property [Text]() As String
    Get
    Return _text
    End Get

    Set(ByVal Value As String)
    _text = Value
    End Set

    End Property
    Private _TitleLabel As Label
    <Category("CMS"), Bindable(True),
    DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
    RefreshProperties(RefreshProperties.Repaint),
    NotifyParentProperty(True),
    PersistenceMode(PersistenceMode.InnerProperty)> _
    Public Property [TitleLabel]() As Label
    Get

    Return _TitleLabel
    End Get
    Set(ByVal Value As Label)

    _TitleLabel = Value
    Me.ChildControlsCreated = False
    Me.EnsureChildControls()

    End Set
    End Property
    Alexander Higgins, Jul 21, 2007
    #1
    1. Advertising

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:
    8
    Views:
    2,224
    deadsea
    Jan 2, 2005
  2. Carlo v. Dango
    Replies:
    14
    Views:
    1,007
    Alex Martelli
    Oct 19, 2003
  3. Pyenos
    Replies:
    2
    Views:
    374
    Pyenos
    Dec 27, 2006
  4. Max2006
    Replies:
    2
    Views:
    502
    Max2006
    Jul 13, 2007
  5. Alexander Higgins
    Replies:
    3
    Views:
    1,063
    Teemu Keiski
    Jul 30, 2007
Loading...

Share This Page