I have a GridGroupingControl into which I''m binding a custom datasource (actually just a DataTable). This DataTable has a column defined called "pk".
When I display the grid, I remove this column using
However, when I then drag a header cell to make it larger, the horizontal scrollbar does not update correctly. Columns to the right of the one I''ve sized disappear from the right-hand edge of the control, but the scrollbar doesn''t update to allow you to scroll them into view.
If I comment out the above ''remove'' statement, the control behaves correctly.
Is this a bug, or am I doing something wrong?
ADAdministrator Syncfusion Team September 8, 2004 08:19 AM
I may be missing the exact sequence of steps you are doing, but I tried to see this behavior in the little sample below, and could not using version 188.8.131.52. Can you see the problem in this sample?
MWMike WoolleySeptember 13, 2004 04:44 AM
Thanks once again for your extremely quick response. The example you have provided does indeed work correctly. I haven''t had a chance to alter this example to try and reproduce the problem (our grid is embedded in a UserControl that is docked ''fill'' into a form that is then displayed using your TabbedMDI stuff, so I wonder if there is some way that the correct size information is not being communicated to the grid. I''ll get back to you if I can reproduce the problem.
I have one further question - I''d like to use a GroupingGrid to be able to display a grid with two columns. The first cell in a row is a static label field from a database and the second is a cell whose type depends on information from the database.
In other words, what I am trying to do is emulate the Windows Forms PropertyGrid control using your grid controls. I thought that the Grouping Grid was probably the way to go as it provides the ''sectioned'' functionality (expand/collapse, etc.) we''re after. However, I''m not sure how to change the type of the cell, or even if this is possible.
ADAdministrator Syncfusion Team September 13, 2004 06:13 AM
As far as your original problem, you might put a Panel where you now have the grid, and then drop the grid into the Panel with grid.Dock = DockStyle.Fill. This may avoid the problem you are seeing.
You can dynamically set properties on cells using TableControlPrepareViewStyleInfo or QueryCellStyleInfo. Here is forum thread that discusses setting style.BackColor, but you can also try conditionally setting style.CellType there.
MWMike WoolleySeptember 14, 2004 09:17 AM
Putting the control in a panel didn''t appear to make any difference. As an alternative, is it possible to bind a custom collection to a grid (e.g. an IList, etc.) and specify the columns that are displayed explicitly (i.e. add columns in rather than remove them).
This may be a better approach (if possible) as I want to display columns containg buttons, icons, etc. based on data that is calculated (but not stored in) the collection.
Once again, many thanks.
ADAdministrator Syncfusion Team September 14, 2004 09:32 AM
After setting the DataSource, try manually populating the Columns collection.
this.gridGroupingControl1.DataSource = dt;
MWMike WoolleySeptember 14, 2004 09:45 AM
A bit confused though. If I set the DataSource, won''t the grid just create a set of columns for me anyhow?
ADAdministrator Syncfusion Team September 14, 2004 09:55 AM
Not if you then start modifying the Columns collection.
The groupinggrid postpones its initialization until things are actually needed. So, when you set DataSource, nothing is added to the Columns collection until you try to use the collection in some manner. If at that point, they are empty, they get initialized to the default whole datasource. If before they are used, you explicitly set the Columns collection, then they will not be initialized to the whole datasource (since when you go to use them, they will not be empty.)
It worked for me using a DataTable. I think it should work for you using an arbitrary IList.
MWMike WoolleySeptember 14, 2004 10:05 AM
Ah! Great. That''s going to be a much better solution for me than removing columns that I don''t need.
Thanks once again!