User (Old forums)MemberMarch 7, 2008 at 7:39 amPost count: 23064
I found this in the documentation however it doesn’t work when I tried the code.
– The CustomColumnManagerRow class is built error
e.Graphics.DrawLine(this.ParentGrid.GridLinePen, e.DisplayRectangle.X + width – 1, 0,
e.DisplayRectangle.X + width – 1, this.Height);
causes an error message: “Error 1 ‘Xceed.Grid.DetailGrid’ does not contain a definition for ‘GridLinePen’ and no extension method ‘GridLinePen’ accepting a first argument of type ‘Xceed.Grid.DetailGrid’ could be found (are you missing a using directive or an assembly reference?)”.
– So I change that line of code to
e.Graphics.DrawLine(this.GridControl.GridLinePen, e.DisplayRectangle.X + width – 1, 0,
e.DisplayRectangle.X + width – 1, this.Height);
The class could be compiled succesfully but I could not see the multiple column headers as it is in the documentation.
Please ask me if you have any questions. Thanks in advance.
Imported from legacy forums. Posted by Hoa (had 5789 views)User (Old forums)MemberMarch 7, 2008 at 8:05 pmPost count: 23064
I see it is possible to merge cells in a DataRow but I don’t know whether it is possible to create a multiple-row and multiple-column grid header in which a header cell could be merged with its neighbor cells.
Thanks for any helps.
Imported from legacy forums. Posted by Hoa (had 843 views)Xceed SupportMemberMarch 12, 2008 at 4:57 pmPost count: 5658User (Old forums)MemberOctober 10, 2008 at 1:44 amPost count: 23064
when you run the sample http://doc.xceedsoft.com/products/XceedGrid/How_to_create_multiple_column_headers.html the header row DOES NOT display. However, if you change it a ValueRow it will display. Only difference is you arent merged cells at this point. Why doesnt the code work like the image on the page?
Imported from legacy forums. Posted by Dan (had 633 views)User (Old forums)MemberOctober 14, 2008 at 4:34 pmPost count: 23064
In fact, it still works, except that the new header rows have a height of 1, which means you don’t see them. The reason for this is that there was a change in the methods and properties used, and DefaultHeight is not consulted anymore. So you need to override GetFittedDisplayHeight to make it work.
You can add the following to the existing code, and you will see the rows appear.
protected override int GetFittedDisplayHeight( AutoHeightMode mode, Graphics graphics, bool printing )
Imported from legacy forums. Posted by André (had 594 views)User (Old forums)MemberNovember 16, 2008 at 10:42 pmPost count: 23064
Hello, I try your method and see the headers, but there aren’t Column name on it,i want to know weather add name on it ,and weather they are real column?
thanks very much
Imported from legacy forums. Posted by Hot (had 319 views)User (Old forums)MemberNovember 17, 2008 at 12:26 pmPost count: 23064
No, they are not real columns, it is only a way of grouping columns together under common headers.
You need to add a custom text to each cell of these headers yourself. You need to do this in the PaintForeground.
protected override void PaintForeground( GridPaintEventArgs e )
int width = 0;
int lastColumn = 0;
for( int j = 0; j < this.GridControl.Columns.Count / m_columns; j++ )
//this is where we set the text of the new grouped column
e.Graphics.DrawString( “some grouped column”, GridControl.Font, new System.Drawing.SolidBrush( Color.Black ), new Point( e.DisplayRectangle.X + width, e.DisplayRectangle.Y ) );
for( int i = 0; i < m_columns; i++ )
this.GridControl.Columns[ lastColumn ].Width;
this.GridControl.GridLinePen, e.DisplayRectangle.X + width – 1, 0, e.DisplayRectangle.X + width – 1, this.Height );
Imported from legacy forums. Posted by André (had 865 views)Xceed SupportMemberJune 22, 2010 at 6:12 pmPost count: 5658
This is a very useful code sample with the amendments Andre and Hoa have posted. Thanks. I’ve got it working fine. There is one more enhancement I would like to add but I cannot work out how.
As my CustomColumnManagerRow currently behaves, when a scrollable column becomes hidden by being scolled to the left of the FixedColumnSplitter (when there are fixed column of course), its column group header becomes shown above the fixed columns.
I would like to be able stop the group header title for a group of scrollable columns from being shown above the fixed columns whenever any of the columns in the group are scrolled the left of the FixedColumnSplitter. I cannot see how to do this. Specifically, what I need to kow is how to detect when a scrollable column becomes hidden by being scolled to the
left of the FixedColumnSplitter. I cannot find an event that I could raise to do this. I would appreciate any suggetions.
Imported from legacy forums. Posted by Simon (had 744 views)User (Old forums)MemberAugust 10, 2010 at 1:07 amPost count: 23064
Does anyone know how to go about creating multiple column headers with the latest version (4.0) of Xceed DataGrid for WPF? I can’t follow the sample code from Xceed’s documentation (see “How to create multiple column headers”) since the current API appears to be significantly different than the one used for this sample code.
Imported from legacy forums. Posted by Matt (had 281 views)
- You must be logged in to reply to this topic.