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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Inheriting from GridControl causing redundant style settings

Thread ID:

Created:

Updated:

Platform:

Replies:

13413 Apr 28,2004 08:22 AM UTC Apr 29,2004 09:30 AM UTC Windows Forms 4
loading
Tags: GridControl
Pete Davis
Asked On April 28, 2004 08:22 AM UTC

I am deriving a class from GridControl. In the constructor for the derived class, I create and add 5 styles to the grid. I also set the AllowSelection property of the grid. When I then add my derived class to a form, all of these styles are auto-generated by the form designer in the InitializeComponent() almost exactly as I have done in the base class. Why is this happening? It''s not causing any problems, it''s just redundant. Is there any way to prevent it? Thanks. Pete Davis

Administrator [Syncfusion]
Replied On April 28, 2004 09:35 AM UTC

Hi Pete, When you make changes in the ctor the BaseStylesMap gets marked modified and therefore all settings will be serialized into code with the designer. To avoid this you should call BaseStylesMap.Modified = false; after you made changes to the BaseStylesMap in your ctor. Code serializtion will then not write out any base styles unless the user made changes to it. Only in the case the user made changes then all settings (also redundant ones) will be written out. Stefan

Administrator [Syncfusion]
Replied On April 28, 2004 12:35 PM UTC

Thanks a ton Stefan. Pete >Hi Pete, > >When you make changes in the ctor the BaseStylesMap gets marked modified and therefore all settings will be serialized into code with the designer. > >To avoid this you should call > >BaseStylesMap.Modified = false; > >after you made changes to the BaseStylesMap in your ctor. > >Code serializtion will then not write out any base styles unless the user made changes to it. Only in the case the user made changes then all settings (also redundant ones) will be written out. > >Stefan >

Pete Davis
Replied On April 28, 2004 04:39 PM UTC

Stefan, Maybe I''m doing this wrong. The last line in the constructor for the class derived from GridControl is: this.BaseStylesMap.Modified = false; As soon as I drop a grid on the form, it re-creates the styles. Did I miss something? Pete

Administrator [Syncfusion]
Replied On April 29, 2004 09:30 AM UTC

I got this to work. I had to remove the grid from the form. Rebuild the project, and then place it back on the form. I had previously rebuilt the project, then removed the grid from the form and added it. I''m not sure why compiling with the grid off the form made the difference. Nevertheless, it works. Thanks. >Stefan, > > Maybe I''m doing this wrong. The last line in the constructor for the class derived from GridControl is: > >this.BaseStylesMap.Modified = false; > > As soon as I drop a grid on the form, it re-creates the styles. Did I miss something? > >Pete >

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;