PrepareViewStyleInfo seems to fire only for cells in one of the panes, regardless of the number of splits you have going. Cells in any other of the panes don't get the benefit of any formatting that happens in PrepareViewStyleInfo. A bug, or a tired user?
ADAdministrator Syncfusion Team November 22, 2002 03:46 PM
There is a certain pattern/rules you have to follow. Check out all the DataBound samples, e.g. the GBGGMultiHeader.
1. In the PaneCreated event handler you should subscribe to events in the new grid pane. In PaneClosing you should unsubscribe.
2. When you handle events from the grid you should not assume that the Grid that was initially created is still there. The pane might have been destroyed. What will remain alive is the model, but the view might be destroyed.
So, when you handle events like PrepareViewStyleInfo you should cast the sender to GridControlBase or GridDataBoundGrid and use the object instead of the gridDataBoundGrid1 member variable that was created at design time.
You could of course also cache the model instead.
IPIvan PellyDecember 2, 2002 09:57 AM
Thanks for the response. My first reaction is, "You're kidding, right?" Since you're not kidding, could I respectfully suggest implementing some developer-friendly default behaviors in a future release? I'm sure the scenario you describe has its benefits, but I bet 99% of developers just want common sense behavior that mimics Excel and/or ComponentOne and Infragistics grids - in this case, have the PrepareViewStyleInfo event fire for all visible cells, regardless of splits. Thanks in advance!
IPIvan PellyDecember 2, 2002 02:01 PM
I looked at the example you suggested, but GridDataBoundGrid doesn't seem to have PaneCreated or PaneClosing events (the example uses the GridRecordNavigationControl, which does have these events). Any suggestions?
ADAdministrator Syncfusion Team December 2, 2002 04:32 PM
The PaneClosing and PaneCreated are members of the SplitterControl class. The sample, GDBGMultiHeader, that Stefan referred you to uses a GridRecordNavigationControl which derives from SplitterControl. So PaneClosing and PaneCreating events are found there as well. He was pointing you to the sample code used there to hook and unhook several grid events in the handlers for the PaneClosing and PaneCreated events.
Attached, you will find a simple sample using PrepareViewStyleInfo to draw a red cell in a GridDataBoundGrid embedded in a SplitterControl.