Hello,
Is it possible to set the cell height in the run time only on selected row?
For example by using RowLayoutColumnInfo.PreferredCellSize?
Because as I use this property it does change the cell height but for all the rows and I need to change it only on currently selected row.
Thanks you,
s
Dear sal_om_ea,
It is possible to set the cell height only on a selected row.
Please use the Override property - RowSizing and set the value to Free. Ex. In the form_load or afterRowActivate event type the following line of code:
//this.ultragrid.DisplayLayout.Override.RowSizing = RowSizing.Free;
Once this property value is set to free, any height you have set to the ActiveRow will be implemented, and all the other rows will be set to the default height.
Please let me know if this helps and/or have any additional questions about this matter.
Sincerely,
Michael Di FilippoDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Thank you for your reply.
I am setting RowSizing to Free and then:
Private Sub ultragrid_AfterSelectChange(sender As System.Object, e As Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs) Handles ultragrid.AfterSelectChange
Dim grid As UltraGrid = CType(sender, UltraGrid) Dim activerow As UltraGridRow = grid.ActiveRow activerow.Cells("ColumnName").Column.RowLayoutColumnInfo.PreferredCellSize = New Size(0, 100)
End Sub
But still the cell is re sizing in all the rows.
What am I doing wrong?
Thank you,
Initially I thought you requested to increase the entire active/selected row’s height.
After researching, my colleagues and I concluded that it is not currently possible to increase the height of a single cell in an active/selected row at runtime.
Therefore, I am trying to get a picture of what your grid will look like.
For example, if you increased a cell's height on the active row, it would either push down the other rows to accommodate the change or the cell may possibly overlap atop the preceding row.
I also submitted a feature request for your idea, to be able to resize an active cell. If your feature is chosen for development, you will be notified at that time.Your reference number for this product idea is PI13040094
If you have any questions about this matter please let me know.
Thank you for your request.
Thank you very much for your reply and for submitting my query as a feature request as this would be very useful feature.
As I mentioned I use grid with Row Layout.
How I would see it work the grid would expand only particular cell in the selected row, without overlapping the proceeding rows.
I was looking to do it in such a way as in the cell I want to expand I have nested grid (by using ControlContainerEditor).
So when I select the row I want to show all the rows in the nested grid.
When using ControlContainerEditor within the grid and setting:
ultragrid.DisplayLayout.Override.RowSizing = RowSizing.AutoFixed
the cell/row should adjust it's height to it's content.
I know that would apply to all rows and I am interested in adjusting only a cell in one row.
But I've noticed it doesn't seems to work on Row Layout?
Or because I populate nested grid in the run time?
Is there any other setting I could use to auto adjust cell or row height that contain ControlContainerEditor with ultra grid?
Kind regards,
Hello sal_om_ea,
Unfortunately you cannot increase the height of a cell that contains an editor or nested grid without affecting the entire row.
It doesn't make sense to me to set the height of one cell independent of the other cells in the same row.It would also be difficult to track what the height of your nested grid is, in order to increase that particular active row’s height.
Also, to increase an active row’s height please take a look at the following event handlers:
Private Sub UltraGrid1_AfterRowActivate(sender As System.Object, e As System.EventArgs) Handles UltraGrid1.AfterRowActivate Dim activerow As UltraGridRow = Me.UltraGrid1.ActiveRow
If activerow.IsActiveRow Then activerow.Height = 150 End If End Sub
Private Sub UltraGrid1_BeforeRowDeactivate(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles UltraGrid1.BeforeRowDeactivate Me.UltraGrid1.ActiveRow.Height = 5 End Sub
These events work along with the RowSizing.AutoFixed or Free.
If you have any additional questions about this matter please let me know.
Hello Michael,
Thank you very much for your reply.
I was able to achieve what I was looking for.
As I mentioned before I use Row Layout so the cell in the row are arranged by me.
Hence re sizing one cell will not affect all the cells withing the row.
I added another ControlContainerEditor2 to my form and assign the same child grid to it.
I set row sizing as follows: ultragrid.DisplayLayout.Override.RowSizing = RowSizing.Default
When the grid is loaded first time I populate the cell with the grid using ContolContainerEditor1 which have the same size for every cell.
When I click on the row I set the height of the ControlContainerEditor2 to numOfChildrid x heightOfIndividualRow.
then I set
ultragrid.DisplayLayout.Bands(0).Override.RowSizing = RowSizing.AutoFixed
and
ultragrid.Rows(activerow.Index).Cells("MyCell").EditorComponent = UltraControlContainerEditor2
To keep all other rows with the size they were originally loaded I have to overwrite the height of each row with the fix figure row.Height = 100 (original row height).
In order to expand cell in another selected row I check for the previously selected row and then set:
ultragrid.DisplayLayout.Bands(0).Override.RowSizing = RowSizing.AutoFreeultragrid.Rows(previousrow.Index).Cells("MyCell").EditorComponent = UltraControlContainerEditor1
and it works perfectly.
I am happy that I was able to assist you.I will now alter this case to show a closed state. Please feel free to open the case within 30 days if you have additional questions regarding my solution.
Thank you for using Infragistics.