Hi,
selecting one or more Headers in the UlttraGrid and pressing Strg-C, copies the first Header and left upper cell. The cell selection below the selected Headers is correct.
The grid should work similar as Excel. The User shoulod be able to select several culumns, by clicking on the header and copy the values incl. the header text into a excel sheet.
I use the following settings:
grid.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;grid.DisplayLayout.ColScrollRegions.Add(colScrollRegion1);grid.DisplayLayout.ColScrollRegions.Add(colScrollRegion2);grid.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;grid.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;grid.DisplayLayout.Override.AllowMultiCellOperations = ((Infragistics.Win.UltraWinGrid.AllowMultiCellOperation)((Infragistics.Win.UltraWinGrid.AllowMultiCellOperation.CopyWithHeaders | Infragistics.Win.UltraWinGrid.AllowMultiCellOperation.Paste)));grid.DisplayLayout.Override.RowSizingArea = Infragistics.Win.UltraWinGrid.RowSizingArea.RowBordersOnly;grid.DisplayLayout.Override.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.Extended;grid.DisplayLayout.Override.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.Extended;grid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended;grid.DisplayLayout.Override.SummaryDisplayArea = Infragistics.Win.UltraWinGrid.SummaryDisplayAreas.None;grid.DisplayLayout.Scrollbars = Infragistics.Win.UltraWinGrid.Scrollbars.Both;grid.DisplayLayout.UseFixedHeaders = true;grid.DisplayLayout.ViewStyle = Infragistics.Win.UltraWinGrid.ViewStyle.SingleBand;grid.Dock = System.Windows.Forms.DockStyle.Fill;grid.Location = new System.Drawing.Point(0, 0);grid.Name = "grid";grid.Size = new System.Drawing.Size(723, 584);grid.TabIndex = 5;grid.Text = "ultraGrid1";grid.UseOsThemes = Infragistics.Win.DefaultableBoolean.True;grid.Error += new Infragistics.Win.UltraWinGrid.ErrorEventHandler(grid_Error);grid.KeyDown += new System.Windows.Forms.KeyEventHandler(grid_KeyDown);grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(grid_InitializeRow);grid.Validated += new System.EventHandler(grid_Validated);grid.KeyPress += new System.Windows.Forms.KeyPressEventHandler(grid_KeyPress);grid.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(grid_InitializeLayout);grid.AfterRowRegionScroll += new Infragistics.Win.UltraWinGrid.RowScrollRegionEventHandler(grid_AfterRowRegionScroll);grid.AfterSelectChange += new Infragistics.Win.UltraWinGrid.AfterSelectChangeEventHandler(grid_AfterSelectChange);
Any Ideas how to solve this?
Hi Mike,
I was wondering under which property contains that "AllowMultiCellOperations" and "CopyWithHeaders"
Hmm,
Sorry, but that's a lame answer. Nothing is easy in programming :) Note that Excel doesn't allow copy if both a row and column are selected. As for memory issues or other technical issues, as a "user" I don't care, just make it so that whatever is selected on screen is what gets put into the clipboard (boy, it feels great to be a user and say that, hah!)
Here's my workaround that I implemented in my application:
private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { TransformColumnSelectionToCellSelection(); }
private void TransformColumnSelectionToCellSelection() { if (ultraGrid1.Selected.Columns.Count > 0 && ultraGrid1.Selected.Cells.Count == 0) { ultraGrid1.Selected.Cells.Clear(); var columns = ultraGrid1.Selected.Columns.Cast<ColumnHeader>().Select(i => i.Column); var cells = ultraGrid1.Rows.Cast<UltraGridRow>().SelectMany(i => i.Cells.Cast<UltraGridCell>().Where(j => columns.Contains(j.Column))); ultraGrid1.Selected.Cells.AddRange(cells.ToArray()); } }
After looking into this in some detail, it turns out not to be as simple as it seems.There are a great many questions and issues surrounding what to do in certain situations.
Like what happens if you have both columns and rows selected?
What if you select a column in a child band in when the grid is grouped?
And how do we handle memory usage if you select a column in a grid with a large number of rows since this would force the creation of every cell in the row.
These and other issues are why this feature was not implemented originally, and so this has been entered as a feature request and may be implemented in a future release.
So, what's the verdict? Is this a bug? If so, what's the workaround?
I tested this out in a small sample, and much to my surprise, I am getting the same results. Perhaps there is some reason for this, but it doesn't make any sense to me. So I'm going to forward this post over to Infragistics Developer Support and have the, investigate this as a possible bug.