How can i DO this

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • news.microsoft.com

    #1

    How can i DO this

    I have a struct but I have properties in that struct public and I want them
    to be visible in the designer for a user control

    so I have a property of SomeItem.Name, SomeItem.Value blah blah

    how can I retain that tree in the designer property window?


  • B Mermuys

    #2
    Re: How can i DO this

    Hi,

    "news.microsoft .com" <discussion@dis cussion.microso ft.com> wrote in message
    news:ufS3kPsoDH A.2416@TK2MSFTN GP10.phx.gbl...[color=blue]
    > I have a struct but I have properties in that struct public and I want[/color]
    them[color=blue]
    > to be visible in the designer for a user control
    >
    > so I have a property of SomeItem.Name, SomeItem.Value blah blah
    >
    > how can I retain that tree in the designer property window?
    >[/color]

    I don't think this works for structs. If you have a property which exposes
    a struct, then this struct is given by value (copy). Assume that there is a
    property SomeItem, which returns a struct, then you cannot simply modify the
    members of this struct:
    e.g. MyUsercontrol.S omeItem.Name = "Test"; will not work... You're trying to
    change a tempory copy.


    Now, with classes/objects this works fine.

    Before the property that exposes an object, put:
    [DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Content)]

    And before the class which you return an object of, put:
    [TypeConverterAt tribute(typeof( System.Componen tModel.Expandab leObjectConvert
    er))]

    The IDE only expands/persists the public properties.

    HTH
    greetings

    ---


    Comment

    Working...