We have a desire to set the Visible Rows on the xamDataGrid. We understand the only way to constrain the number of rows is to set Height, MaxHeight, or put the control in a container control that constrains it's height. Is there a way to compute Height, based on a desired number of visible rows?
Thanks, that works.
I tried to get the current state of the Horizontal ScrollBar with no success.
So I think this has to be done by comparing the Actual Width of the XamDataGrid to the sum of the widths of all the cells (CellValuePresenter).
Alex.
One last question and I think the algorithm will be golden. How to I determine if the current xamDatagrid is showing the horizontal scrollbar (i.e. the widths of all the columns are currently to wide for the container?
I think that the Loaded event of the grid is appropriate for this. You can also set some relation between the "magic number" and the row's height in some other event to keep track of changes.
Because we have a current fixed style, I can determine that the approximate height of a row for us is 24.5 pixels. This works reasonably well for us for allowing to user to "a priori" set a number of visible rows, or change dynamically with an increase/decrease visible rows slider. It's just that when the style is changed, we have to remember to change the "magic number" constant.
I will try the adding/removing row idea. It would have to happen before the grid was rendered.