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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Datagrid scaling and font size

Thread ID:





126962 Oct 18,2016 07:49 PM UTC Oct 24,2016 04:00 AM UTC WPF 3
Tags: SfDataGrid
Asked On October 18, 2016 07:49 PM UTC

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.

Jai Ganesh S [Syncfusion]
Replied On 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  

Replied On 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.

Jai Ganesh S [Syncfusion]
Replied On 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   


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon