We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Datagrid scaling and font size

What I'd like to do is to be able to set it so the amount of text displayed in the columns is fixed and when the grid is resized the size of the font changes to keep the text displayed in each row fixed while having the number of rows shown vary as needed.

Using your Expense Analysis Sample to show what I want, I took a screenshot stretched the grid by 50% in height and width to simulate text enlarging as the window was widened, and then cropped out 2 of the 6 rows of data so that the number of rows visible was reduced because the hieght wasn't changed.

3 Replies

JG Jai Ganesh S Syncfusion Team October 20, 2016 01:15 AM UTC

Hi dan, 
We cannot understand your requirement clearly but we suspect that you don’t want to change the Grid’ s font size while we increasing/ decreasing the grid height and width. By default, our SfDataGrid works like this only. In the Expense Analysis sample, the Font size is not changed for the Grid while we resizing the window but some rows are hiding. This is the default behavior of SfDataGrid. 
If we misunderstood your requirement, please share the more information about your requirement. This would be more helpful for us to proceed further. 
Jai Ganesh S  

DA dan October 20, 2016 12:47 PM UTC

Increasing/decreasing the font size when the width changes is exactly what I want to do.  The amount of text in my columns is fixed.  I don't want huge amounts of empty space in every cell or horizontal scrollbars because the text size stays fixed.  My baseline target is a fullscreen kiosk style application, so in normal circumstances the height and width would grow at the same rate and the number of rows shown at once would also remain approximately constant (give or take the difference between 16:10 or 16:9 screens anyway).

If it wasn't for the fact that doing so would make the column headers scroll out of sight, nesting a standard MS DataGrid inside a ViewBox (to stretch it to fit horizontally while making it taller than the available space) inside a ScrollViewer (to scroll the result up and down again) would do roughly what I want.

JG Jai Ganesh S Syncfusion Team October 24, 2016 04:00 AM UTC

Hi dan,  
We have analyzed your query and you can achieve your requirement to fit the font size of the grid while we increase/ decrease the height and width of the window by loading the SfDataGrid inside the ViewBox and also set the Columnsizer as “SizeToCells”. 
<Viewbox > 
           <Syncfusion:SfDataGrid ItemsSource="{Binding ProductDetails}" AutoGenerateColumns="True" ColumnSizer="SizeToCells" 
Jai Ganesh S   

Live Chat Icon For mobile
Up arrow icon