Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
UserControl and Ultra* controls editor in IDE
posted

Hi

Ive created my own UserControl (contains of label + UltraTextEditor - and similar controls)
Then in my UserControl class Ive added Browseable prop returning this contol

Like this:

[Browsable(true)]
        public Control                    _Editor {
            get { return this.ultraControl; }
        }

Then in design mode I can see in Visual Studio what Ive expected (_Editor node) - can do changes, changes are reflected in design preview.
But issue is that those changes are not being saved. So if I close and open this file, or compile app - all changes I did in design mode are lost

Can you please help me understand what Im doing wrong here ?
How to archive that?

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    I tried this out with both a TextBox and an UltraTextEditor and I get the same results. So I don't think your question is specific to the Infragistics controls. 


    But as a control developer, I've had a lot of experience with designer serialization - and I can tell you it's a lot more complicated than this. :) 

    I'm not sure simply exposing a control to the designer like this is a good idea. You will almost certainly run into a lot of weird issues with sub-objects and property change notifications that may or may not dirty the designer for some properties. I'm sure Microsoft has extensive documentation on the subject of developing your own controls and providing designer support for a wide range of scenarios, so if you want a really robust designer experience for your UserControl, you should probably start there. But as I said, it's a lot more complicated than you seem to be making it out to be. 

    Having said all that, I was able to get a lot of stuff working in my sample using the DesignerSerializationVisibility.Content. This works for simple properties like Text. But I did not test it for anything more complex than that.

            [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
            public UltraTextEditor UltraTextEditor
            {
                get { return this.ultraTextEditor1; }
            }

Children