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


Hi, I am having 2 problems with using a GridGroupingControl: 1) Using the TableDescriptor Columns to create a reduced list of properties to display, I am trying to display a property of type Byte[]. Whenever a cell containing a Byte[] that is not null is displayed, the cell turns red and says "Exception". I use this same method to display the value of other properties with no problems. What am I doing wrong? 2) I have a UITypeEditor that works very well in a PropertyGrid. I''d like to reuse that UITypeEditor for specific cells in the GridGroupingControl. Also, different cells in the same column might have different UITypeEditors. How can I do this? Thanks, - Jon

11 Replies

AD Administrator Syncfusion Team August 2, 2005 10:42 PM UTC

1) The grid does not know how to display a byte[]. If you have 18000 numbers in the array, what do you want to see in the cell? One way you can handle this is to use the TableControlDrawCell event and draw what you want to see.
private void gridGroupingControl1_TableControlDrawCell(object sender, GridTableControlDrawCellEventArgs e)
	GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
	if(style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.MappingName == "byte"
		&& (style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell ||
		style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell))
		using(Brush b = new SolidBrush(style.BackColor))
			e.Inner.Graphics.FillRectangle(b, e.Inner.Bounds);
			GridStaticCellRenderer.DrawText(e.Inner.Graphics, "bytes", style.GdipFont, e.Inner.Bounds, style, style.TextColor, false);
		e.Inner.Cancel = true;
2) You can create a custom cell type that uses your custom control. See the samples of custom celltypes here: \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\CellTypes\CalendarCells \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\CellTypes\SliderCells You can see how to add custom celltypes to a GridGroupingControl in this sample: \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\Grouping\CustomCellTypes Here is a sample with a type editor cell type. \Syncfusion\Essential Studio\\Windows\Grid.Windows\Samples\Grouping\CustomFieldType

JJ Jonathan Jones August 3, 2005 04:17 PM UTC

Hi Clay, Your solution for #1 definitely solved that problem. Thanks! I guess I assumed that the GridGroupingControl would work the same as a PropertyGrid when displaying Byte[] (property grids call ToString on the Byte[] array in question). As for #2, the code you pointed me to had no examples of using a UITypeEditor. However, after some digging, I found that I could do the following: grid.TableModel.CellModels["ConfigData"] = new GridUITypeEditorCellModel(grid.TableModel); If I set the CellType for the column to "ConfigData", it _almost_ works, but I still have the following problems: - The drop-down arrow won''t show up. Instead, the UITypeEditor is displayed as soon as you click on the cell. I''d prefer if it behaved like the property grid (the UITypeEditor is not shown until the drop-down arrow is clicked). - If I click on one cell with a UITypeEditor, and then immediately click on a different cell also with a UITypeEditor, the UITypeEditor from the previous cell is shown. If I click on another cell first before clicking on the new cell, this problem does not happen. Any ideas? Thanks, - Jon

AD Administrator Syncfusion Team August 3, 2005 05:20 PM UTC

If your CellValueType property is set to s object that supports type convserion and has a typeeditor associated with it, the gridgroupingcontrol will use the editor by default. As far as the problems you are seeing, I think if you register a UI celltype for each dropdown column you have, the problem will go away. In addition, the defaultbehavior is to show the buttons. There is a style.ShowButtons property that controls this. Do you have this set? Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GroupingArrayList_f8617266.zip

JJ Jonathan Jones August 3, 2005 05:46 PM UTC

Hi Clay, OK, here are some gory details: - I only have one column that needs to use the UITypeEditor. The problem I was having regarding the clicking on different cells was when I clicked on the same column, but in a different row. - The underlying data source for the grid is an array of objects, all a subclass of a common base class. They may be different subclasses, each with a different UITypeEditor for the base class property being shown in the grid. - I already had ShowButtons set to "ShowCurrentCell", but the drop down arrow never appears. Even if I change it to "Show", the arrow button is still missing. Do you have any more suggestions? Thanks, - Jon

AD Administrator Syncfusion Team August 3, 2005 06:03 PM UTC

If you are using derived classes, you might try making your collection list implement ITypeList to make sure you specify the exact types you expect to use (wether a derived type or a base type). Doing this has avioded some problems with derived type and base types. Whether it will affect this problem, I do not know. If you can modify teh sample I uploaded to show the problem, or if you can upload a sample showing the problem, we can try to spot something here. Or, you can submit a Direct Trac support incident with sample if that would be better for you.

JJ Jonathan Jones August 3, 2005 07:10 PM UTC

Hi Clay, I''ve updated the solution and attached it. It shows all the problems I mentioned (in the Data column). Unfortunately, I do not know the derived class types until runtime. Plus, the single ArrayList the grid is displaying can contain different derivations of the base class. I have already implemented the array list as an ITypedList of the base class (which I believe you suggested to me some time ago), and that part works well. Please let me know what you find. Thanks! - Jon

AD Administrator Syncfusion Team August 3, 2005 07:24 PM UTC

The sample did not make it. You can try it again(, or you can send it to support@syncfusion.com and mention this tread in the subject line. Also update this thread when you have sent it).

JJ Jonathan Jones August 3, 2005 07:59 PM UTC

AD Administrator Syncfusion Team August 3, 2005 10:55 PM UTC

The reason the button is not appearing is because of the DrawCell handler. This prevents the default button from appearing. Biut there are other things not right here. We will have to look into this.

AD Administrator Syncfusion Team August 4, 2005 12:08 AM UTC

Changes have been made in our library to handle the problems. They will be in the upcoming 3.3 release.

JJ Jonathan Jones August 4, 2005 02:53 PM UTC

Hi Clay, Thanks for the information. I guess I found something good. Is there a workaround I can code to get around the problem until 3.3 is available? When do you expect 3.3 to be available? Thanks for all your help! - Jon

Live Chat Icon For mobile
Up arrow icon