I have created a custom grid by creating a class that inherits from UltraWinGrid and allows me set up up some standard event handlers for each instanc eof the grid. I have a few instances of the custom grid and at design time I have set some columns of the grid to be hidden and changes the caption for some columns. Every thing works a treat.
However sometimes I find that having changed something in the form that the grid are located on and the designer.cs code is re-genertaed then I have lost some of these design time changes.
Is there something I need to do in the custom grid to ensure the non-default properties are always generated when the design code is being generated.?
Pat
Hi Pat,
The grid will lose it's layout if the data source send a reset notification or if the grid's datasource is set at run-time. When deriving from a grid, it's possible that the deserialization of the grid may take place at a time when the grid thinks it is at run-time even when it's really on a form designer. It's very hard to know and the designer does some things you might not expect with derived controls.
What I would recommend is that you set up your layout in the InitializeLayout event of the grid. This way, the layout will be handled in your code and will never be lost.
Another option would be to save the layout to a file. You can do this using the Layout Wizard on the grid at design-time, then load the layout into your grid at run-time.