Reputation: 21
I am looking for the best approach to getting the vertical height of a UltraWinGrid to change based on the number of rows it is bound to such that all rows are visible with no scroll bar. The intention is to stack several grids vertically in a scroll panel so only a single panel scroll bar appears when necessary rather than a scroll bar for each grid.
Upvotes: 2
Views: 11682
Reputation: 3228
The following post has a sample that gets the height of a UltraWinGrid and may be a good starting point for you: http://blogs.infragistics.com/forums/p/18548/321187.aspx#321187
Upvotes: 0
Reputation: 1032
Basically the approach would depend on the current settings of your UltraGrid. Assuming that you have all rows with the same height than you could use something like the following:
int gridHeight = ultraGrid1.Rows.Count *ultraGrid1.DisplayLayout.Override.DefaultRowHeight + ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.Height + ultraGrid1.DisplayLayout.Bands[0].Header.Height + someConst;
Where the Column header and the Band header might not present into your layout. The "someConst" refering to the "BorderStyleRow" property becasue the row border should also be taken into account when calculating the UltraGrid height. One more thing that you would like to consider would be the height of the GroupByBox if it is visible in your UltraGrid.
If this approach does not work for you please provide me more details of exact settings in your UltraGrid so I will try to assist you further with this matter.
Upvotes: 1