I have an application that displays league tables for sporting leagues. These tables are basically grids with different columns representing statistics for each team such as matches played, won, lost, goals scored and concieved etc. As such, a league table has one interesting property: For a given competition, we always have the same amount of rows (representing the teams). Since WPF controls are lookless, I could probably use a ListBox, a ListView, an ItemsControl directly, or even a DataGrid. Shouldn't matter all that much.
However, I want something that I haven't yet been able to achieve: Given the table size (in practice, the size of the window), ALL teams should be visible at all times (no vertical scrolling), all statistics columns (as chosen by the user) should be visible, and the font size should reflect this so that it is as large as possible without any column becoming too large for the contents to fit.
I can easily use a UniformGrid to achieve the no-vertical-scrolling part. However, adjusting the font size doesn't seem to be quite as easy.
There is of course the ViewBox, which would allow the content of each table cell to individually size itself to be as large as possible, but this would possibly lead to ugliness as you would end up with a bunch of cells with varying sizes.
I don't expect to get an easy answer to this, but if it is at all possible, I would love to hear about it. In summary:
Table should resize with window while always showing all data without scrollbars.
Font size should be set to largest possible size that allows each column of every row to display all its' contents.
All columns should size to smallest possible size that allows all contents to be visible, except for one column that does "*-sizing" to eat remaining space.
So.. Any clever ways to do this? 🙂
Would it work for what you need make the child element of the window a ViewBox and put all the content within it? I'm not sure if the details of what you're doing will cause this not to work, but here's an extremely simple example of what I'm suggesting:
The entire content is always visible, with the maximum possible font size. All text scales uniformly.