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
80
problem with inherited UltraTextEditor
posted

Hi all,

I have the following problem: I created my own control inherited by the UltraTextEditor and just added two right buttons in right with icons and some code in the event handlers. Everything is fine design time, when I place my control in a form I can see my 2 buttons, but when I build and run the application the VS generates in the IntializeComponent() method code that add my buttons again and as result runtime I see 4 buttons instead 2. I’ll appreciate if anybody tell me why this is happened and how to prevent this.

 

Thanks in advance.

 

Parents
No Data
Reply
  • 390
    posted

     

    I had the same problem and I resolved it by using the following code.

     In the Inherited control, create a new ReadOnly property called ButtonsRight (or ButtonsLeft if that's what you are using). This property should just return the base control's ButtonsRight property. Mark this property with the attribute DesignerSerializationVisibility set to Hidden.

    The drawback to this is that if you try to inherit your inherited control and you want to add more buttons, you will have to do it in code.

    I'm using this in several projects and it works just fine for me.

    If you need, I can send you a code sample.

Children
No Data