Dear infragistics,
I have an ultraGrid (Infragistics Winform UltraGrid 12.1 with latest update) and I've manually made a data schema in the grid's designer.
I've proceeded to make a Row Layout for Band 0 like: Standard View = true, Keep Headers With Cells = true, Label Position = Left. And I've only inserted 1 column (eventually) to get the grid to do what I want. Because...
It seems it's sizing the header of the column to the content of the cell. Which is wanted in most circumstances. But in my case I have the Label Position to the Left, so I want the header to size to it's own caption.
InitializeLayout looks like:
Infragistics.Win.UltraWinGrid.UltraGrid grid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; grid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False; grid.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect; grid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single; grid.DisplayLayout.PerformAutoResizeColumns(true, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand); Infragistics.Win.UltraWinGrid.UltraGridLayout layout = e.Layout; Infragistics.Win.UltraWinGrid.UltraGridOverride ov = layout.Override; ov.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Free; foreach (var band in layout.Bands) { foreach (var col in band.Columns) { col.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand); } }
I've included the file "longheader.png" to show what the problem is. Then when you doubleclick on the seperator on the right side of the header it actually snaps back to the size that i want, which you can see at "shortheader.png".
See, i've set AllowColSizing to Free. Doesn't work. I've set Runtime Label Sizing in the Rowlayout to None. Doesn't work. Can it be done? and how?
Thank you in advance for answering.
Hi Danny,
I took a look at this, and there does not appear to be any easy way to do this in code. The code that is called internally when you double-click on the right edge of the cell is not accessible via any public methods, and it's tightly tied to a particular UIElement.
I think this is something of an oversight, and quite frankly, I'm surprised no one ever noticed it before. So I'm going to ask Infragistics Developer Support to create a case for you and write this up as a bug for developer review. So maybe we can add some new methods to do this in the future. Unfortunately, 12.1 is retired, so any new methods we added would only be available in the latest support versions, which means 13.1 and up (assuming we fix it soon).
In the mean time, the only solution I can think of would be to explicitly set the width of the header in code.
foreach (var band in layout.Bands) { foreach (var col in band.Columns) { col.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand); col.RowLayoutColumnInfo.PreferredLabelSize = new Size(100, col.RowLayoutColumnInfo.PreferredLabelSize.Height); } }
Mike,
Yeah that works. Luckily you normally know the width of a label, because you know the piece of text it needs to contain. So in that respect you guys can get away with it just fine in my personal opinion. ;)
I think what would suit the needs is a way to tell PerformAutoresize function to take into account the Label Position. When it's Left, you should have the option to tell the function not to size the labels with the content of the cell, but rather with the texts inside the label itself.
Let's see if I can get my employer to upgrade to version 13 *sigh*.
DannyvdK said:I think what would suit the needs is a way to tell PerformAutoresize function to take into account the Label Position. When it's Left, you should have the option to tell the function not to size the labels with the content of the cell, but rather with the texts inside the label itself.
Interesting. I was thinking of doing it another way, but this makes more sense. :)
Hello Danny,
This issue has been resolved in the latest Service Release as of the date of this post. This service release is now available under your account at the Infragistics Website. To download the service release, log in to ‘Account’ and select ‘Keys & Downloads’. Select the appropriate tab for this product; then the license key. The available service releases (Hot Fixes) should now be listed on the page.
I have created CAS-126635-K4Y2Y3 to track this issue. I have logged the behavior with our developers. You can find more information in the support case.
You are welcome. ;)