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.

Subclass of GridGroupingControl (3.3.0.0)

Thread ID:

Created:

Updated:

Platform:

Replies:

35438 Sep 29,2005 10:44 AM Oct 2,2005 08:48 PM Windows Forms 4
loading
Tags: GridControl
Jonathan Jones
Asked On September 29, 2005 10:44 AM

Hi, I''m trying to develop a subclass of GGC so I can apply a specific set of defaults to the class. The idea is that every tool we develop using this subclass would have the same look and feel we want to provide. I want the users of the subclass to have the freedom to modify the properties in the designer. At the same time, if the user resets ANY property, I want it to revert back to the defaults I provided for the subclass. Also, if I change the default properties of the subclass, I want the changes to be automatically reflected in users of the subclass, assuming the users did not explicitly override the property setting, but simply took the defaults. This is easy enough for simple properties such as BackColor. I have to make sure I re-implement the property with my own DefaultValue attribute. It gets more complicated when talking about properties such as BaseStyles. I am having several problems with this: - I can''t specify a DefaultValue attribute for BaseStyles, Appearance, or other complex properties (that I am aware of). - When I drop the subclass into another form, the BaseStyles that I specified in the subclass get wiped out. This is because BeginInit() is being called twice for the subclass (once in InitializeComponent of the subclass, once in InitializeComponent of the form using the subclass). - If I fudge my subclass so BeginInit() does not get called twice, the class exceptions during initialization. This is because, when I drop the subclass into a form, it wants to re-apply the same BaseStyles again (once that already were applied in the subclass). - If I take a different approach, and put the GGC inside a UserControl and use that as my subclass, I have the opposite problem. The designer of the form containing the UserControl has no ability to modify the properties or events of the grid, even if I expose the grid through a public property of the UserControl. Any help is appreciated, as I am really stuck at the moment. Thanks, - Jon

Administrator [Syncfusion]
Replied On September 29, 2005 10:48 PM

Hi Jonathan, there are two styles in the GridEngine class that define the default style for all styles in the engine: internal GridTableCellStyleInfo engineDefaultStyle = new GridTableCellStyleInfo(); internal GridTableOptionsStyleInfo engineDefaultTableOptions = new GridTableOptionsStyleInfo(); You would need to use reflection to access them. I can also provide public access to them in future. But there is also even a better place for you I think. The GridTableCellAppearance has a static Default property. Just access it as follows: GridTableCellAppearance.ColumnHeader.Font.Italic = true; Now every column header cell will use these settings as default. They will show up even in the propertygrids at design time as default settings. Stefan

Jonathan Jones
Replied On September 30, 2005 09:37 AM

Hi Stefan, I tried modifying the default as you suggested, but I keep getting the following exception: - GridTableCellAppearance is Read-only. You must not change the GridCellAppearance.Default object; change the Engine.Appearance object instead. Any ideas? Thanks, - Jon

Jonathan Jones
Replied On September 30, 2005 10:54 AM

Hi Again, After some digging, I tried to override the CreateEngine() method to get the desired behavior. However, this was not working. I think I found part of the problem. In the source for GGC (GridGroupingControl.cs), in the BeginInit() call, there is a call to the following: initEngine = new GridEngine(); I think this means that any attempt to override the engine factory will fail. Shouldn''t that call be changed to the following: initEngine = CreateEngine(); Thanks, - Jon

Administrator [Syncfusion]
Replied On October 2, 2005 08:48 PM

Jonathan, I am working on a sample for both your question s(also the one with MouseButtons / replacing the MouseControllers). There might a code change be necessary in the grid.grouping source code. Let me get back to you later this week. Stefan >Hi Again, > >After some digging, I tried to override the CreateEngine() method to get the desired behavior. However, this was not working. > >I think I found part of the problem. In the source for GGC (GridGroupingControl.cs), in the BeginInit() call, there is a call to the following: > > initEngine = new GridEngine(); > >I think this means that any attempt to override the engine factory will fail. Shouldn''t that call be changed to the following: > > initEngine = CreateEngine(); > >Thanks, >- Jon

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.

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.

;