We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom Designer

Hello, I have the following problem: I created an inherited class that inherits DataGrid and I added a property called MyProperty as integer. Then I created another class called CustomDesigner that inherits from System.Windows.Forms.Design.ControlDesigner and I setup the Design Attribute for my grid class to use this custom designer. All works ok (I can see some messages I inserted in the Initialize() function in the designer)... but... I fail to understand how to make the actual "connection" between the changes in the property and the code behind the form. For example, if I change the property "AllowDrop" from the default value of false to True, if I look in the code, right away the line: Me.TestGrid1.AllowDrop = True appears in the InitializeComponent() routine.... But, when I change the additional property (MyProperty) nothing changes in the code behind the form, therefore rendering my custom designer to a useless item... So, my question is: how can I "catch" the changes in the properties that extend a base class and reflect them in the InitializeComponent() function from the code behind the form? Any help is appreciated, Thank you! :thumb: Iulian PS: If you know any books that talk about custom designers...

2 Replies

RK ruud krank February 18, 2003 11:39 AM UTC

Please see www.bluevisionsoftware.com, 'books' section > Hello, I have the following problem: I created an inherited class that inherits DataGrid and I added a property called MyProperty as integer. Then I created another class called CustomDesigner that inherits from System.Windows.Forms.Design.ControlDesigner and I setup the Design Attribute for my grid class to use this custom designer. > All works ok (I can see some messages I inserted in the Initialize() function in the designer)... but... I fail to understand how to make the actual "connection" between the changes in the property and the code behind the form. For example, if I change the property "AllowDrop" from the default value of false to True, if I look in the code, right away the line: Me.TestGrid1.AllowDrop = True appears in the InitializeComponent() routine.... > > But, when I change the additional property (MyProperty) nothing changes in the code behind the form, therefore rendering my custom designer to a useless item... > > So, my question is: how can I "catch" the changes in the properties that extend a base class and reflect them in the InitializeComponent() function from the code behind the form? > > Any help is appreciated, > > Thank you! :thumb: > Iulian > > PS: If you know any books that talk about custom designers... >


RP Ramesh Praveen Syncfusion Team February 19, 2003 11:28 AM UTC

Iulian, If all you need is for the custom property's value to appear in the InitializeComponent block, then you don't even need a custom designer. Make sure that the control's type and the instance are both your derived type. Otherwise it beats me as to why your custom property's non-default value won't appear in code! -Praveen

Loader.
Up arrow icon