Hi,
One of the requirements of my application is to let the user change the font size on the fly. I user a slider for the font size and the FontSize property of the window is bound to its value. This works great (almost), since the controls all take that value.The ribbon, labels, the dock manager, everything resizes correctly. Different story for the XamDataGrid. The column headers resize correctly (i.e. if I increase the font size, the headers' height increases as well). This does not work for the actual record rows, however. The font size increases, but the rows remain at the same height, chopping off the characters displayed in the cells. I tried setting CellHeight to Auto, but that property only accepts numeric values.
Is there any way to get the record rows to increase their height when the font size changes??
Thanks,Michel
Hi Michel,
I tested this out. It appears that the record heights adjust appropriately if the grid's AutoFit property is set to true, but not otherwise. I suggest you report this issue to our Developer Support group so that it can be addressed and you will be notified when it is resolved. Sorry for the inconvenience.
Josh
Hi Josh,
Tried that this afternoon and it does resize the row height. Unfortunately, AutoFit=True is the incarnation of pure evil. You lose your column settings (my grid only has 3 columns - two short ones and a long one, so I tricked it into always making the last one use whatever remaining space there is.) AutoFit makes them all the same width.
Now I'm thinking about devious schemes like calculating a new height whenever the font size changes and changing the height on the fly (which is what I'm doing with the column widths), I'm just not sure I'm courageous enough to get into that - I hate font metrics and other spacing calculations, there's always a little tidbit missing and the result doesn't look quite "natural".
In the meantime, I'll submit a bug report. We don't have to go into production with this for a little while, so with any luck it can be resolve before I have to resort to black magic or something. :)
If the Columns are set to AutoFit = true, there still have method to make them in different width. You just make them in different ColumnSpan values, them they can have different scale.
Like:
Field A: ColumnSpan = 1;
Field B: ColumnSpan = 1;
Field C: ColumnSpan = 5;
Then the column C will have 5 time longer than the Field A and Field B.
I just tried it and it's fine - the row height gets adjusted when I change the font size dynamically (I have an option in the ribbon to change the font size on the fly.) But note that I'm not using any of the "auto" stuff in the grid.
Looks like it's still there in 9.1. AutoFit has not effect but to distort the height of the header at Startup. there may be a rule where other formatting is not allowed in conjunction with AutoFit.
I discovered if I use AutoArrangeCells="LeftToRight" along with AutoFit on the grid, it stops the distortion but the row height stays the same. there is some combination of options out of place here.
Glenn