Hi everyone
I have a problem related to the row height. I set it for example to 15 but ActualHeight of the CellControl still 26. Could you help me with that?
Hello Gleb,
I have put together a small sample project in an attempt to reproduce the behavior you are referring to, but I can't say I am seeing the behavior you are reporting. When inspecting the CellControl elements of the XamGrid in my small sample project after setting the RowHeight property to 15, the CellControl.ActualHeight property also returns 15.
One thing I am noticing is that the HeaderCellControl elements are still at an ActualHeight of 26, and so perhaps this is the element that you are inspecting that is returning the "incorrect" height? If so, you can control the header's height by setting the HeaderRowHeight property of the XamGrid.
I am attaching the sample project I used to test this. Please test it on your machine to see if you receive the same results as in your project. My tests were made against version 17.1.20171.1000. If this differs from the version that you are currently using, could you please provide the version that you are testing against?
If the project does show the product feature working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
OK, I found the MinimumRowHeight property which doing what I want for rows.
But I could not find the same property for headers, do you have any idea?
Thanks for your answer. I had a look more and it looks like the MinimumRowHeight property works for headers as well.
Thank you for your update. I would recommend that you continue with the MinimumRowHeight property, and I am glad it does what you are looking for in this case.
As for the headers, you are correct that there does not currently exist a "MinimumHeaderRowHeight" property, although unless your XamGrid is hierarchical, I would expect that the cells in this particular row would remain a consistent height, and that you could use the HeaderRowHeight property on your XamGrid? It is also worth noting that if your XamGrid is hierarchical, each of the ColumnLayout elements in the XamGrid have a HeaderRowHeight as well, and so you can set the header heights on your child bands this way.
If you wish to get the XamGrid HeaderRow, though, I would recommend that you use the Infragistics.Windows.Utilities class and its GetDescendantFromType method to get an element of the type HeaderCellControl from the visual tree of the XamGrid. From there, you can get the HeaderCell from its Cell property and the HeaderRow from the Row property of the HeaderCell. The code for this would look like the following, where "grid" is the XamGrid:
HeaderCellControl cellControl = Infragistics.Windows.Utilities.GetDescendantFromType(grid, typeof(HeaderCellControl), false) as HeaderCellControl;HeaderCell cell = cellControl.Cell as HeaderCell;HeaderRow row = cell.Row as HeaderRow;
From there, you can set the Height on the HeaderRow manually by setting its Height property. If you wish to find which cell has the largest content, you can also loop through the HeaderRow.Cells collection and get the HeaderCellControl from each HeaderCell's Control property. The HeaderCellControl will then have a Content property that returns the content of that particular cell. Note, if a HeaderCell is not currently in view, its Control property will return null, as it will be virtualized.
I hope this helps. Please let me know if you have any other questions or concerns on this matter.