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

SfDataGrid potential bug on setting FontSize

I may have found a bug in SfDataGrid, if I set its FontSize property to lets say 20. It works in Windows 7 and entire grid has FontSize 20 but in Windows 10, it ignores that FontSize property and uses maybe default FontSize.

So I'm forced to use GridCell style and set FontSize there to make it work in Windows 10 as well.

Please fix this.

7 Replies

FP Farjana Parveen Ayubb Syncfusion Team September 18, 2019 12:21 PM UTC

Hi John, 
 
Thank you for using Syncfusion support. 
 
We have analyzed your query, the FontSize for SfDataGrid is works fine in Windows 10 Pro machine on our end, could you please find the below screen shot and sample location. 
 
 
 
  
Could you please share your OS and Syncfusion version, that will help us to provide the better solution. 
 
Regards, 
Farjana Parveen A 



JO John replied to Farjana Parveen Ayubb September 19, 2019 07:22 AM UTC

Hi John, 
 
Thank you for using Syncfusion support. 
 
We have analyzed your query, the FontSize for SfDataGrid is works fine in Windows 10 Pro machine on our end, could you please find the below screen shot and sample location. 
 
 
 
  
Could you please share your OS and Syncfusion version, that will help us to provide the better solution. 
 
Regards, 
Farjana Parveen A 


Remove this
<Style TargetType="syncfusion:SfDataGrid">
            <Setter Property="FontSize" Value="20"/>
        </Style>

and use this

        <syncfusion:SfDataGrid x:Name="dataGrid"
                               AllowFiltering="True"
                              FontSize="20"                   
                               ShowGroupDropArea="True"
                               AllowEditing="True"
                               AddNewRowPosition="Top"
                               ItemsSource="{Binding Orders}">
        </syncfusion:SfDataGrid>


SS Susmitha Sundar Syncfusion Team September 20, 2019 12:30 PM UTC

Hi John,   
   
Thanks for your update.   
   
We have checked the FontSize for SfDataGrid it works fine from our end. We ensure this in Windows 10 Pro configuration machine. Please find the OS details below.  
   
    
   
 We have prepared the video and sample for the same. Please refer the below link.  
   
   
   
Could you please provide your machine configuration details? It will be useful for us to investigate further.   
   
Regards,   
Susmitha S   



FS Fanourios Siskakis May 17, 2022 10:20 PM UTC

Hello again unfortunately,

This somehow seems to be a problem pertaining to newer versions of the Datagrid.

I am using the last version of Syncfusion.SfGrid.WPF 20.1.0.55 and .net core 6 and by simply setting the FontSize="20" nothing happens.

I tested this to your sample project "Syncfusion wpf-demos-master" in the GettingStarted.xaml file of the

syncfusion.datagriddemos.wpf_lib_60 project.


Could you take a look at this?

Is there another hack to change the cell's fontSize until this issue is resolved?

With kind regards

Fanourios Siskakis



VS Vijayarasan Sivanandham Syncfusion Team May 18, 2022 03:46 PM UTC

Hi Fanourios Siskakis,

We have prepared the sample to achieve your requirement. Please find the sample in the attachment.


For more information related to font settings, please refer to the below user guide documentation link,

UG Link: https://help.syncfusion.com/wpf/datagrid/autosize-columns#changing-font-settings-for-datagrid

https://help.syncfusion.com/wpf/datagrid/autosize-columns#auto-width-calculation-based-on-font-settings

KB Link: https://www.syncfusion.com/kb/5961/how-to-change-the-columns-fontsize-and-inputscope

https://www.syncfusion.com/kb/12132/how-to-change-the-font-size-for-header-with-columnsizer-as-sizetoheader-in-wpf-datagrid

Please have a look at this sample and let us know if you have any concerns in this.

Regards,

Vijayarasan S


Attachment: SfDataGridDemo_1beda24d.zip


FS Fanourios Siskakis May 18, 2022 06:46 PM UTC

I can see that in your project it works as expected. In my printscreen, as stated above, you can see that with your default code from the project stated above, changing only the FontSize and it doesnt work.


Can it be that the FontSize needs some specific attribute/s to be "activated" somehow?
Otherwise i am out of ideas...

I uploaded a zipped printscreen of the sollution, since uploading the whole project 2something gb would be not possible


With regards

Fanourios Siskakis


Attachment: print_13df9715.rar


VS Vijayarasan Sivanandham Syncfusion Team May 19, 2022 02:48 PM UTC

Hi Fanourios Siskakis,

We have applied the theme for the GettingStarted sample in the WPF demos. In this case, the font size is displayed based on the applied theme. So, the changed font size property is not replicated in SfDataGrid.

However, your requirement to change the font size in SfDataGrid can be achieved by adding the ResourceDictionary based on the applied Theme (ex: MaterilaLight). Basedon property bound with SyncfusionGridCellStyle as StaticResource in defined Style based. Please refer the below code snippet,

<syncfusion:SfDataGrid.Resources>

                <ResourceDictionary>

                    <ResourceDictionary.MergedDictionaries>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/Window.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/SfDataGrid/SfDataGrid.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/TextBox.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/TextBlock.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/ComboBox.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/Button.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/RadioButton.xaml"/>

                        <ResourceDictionary Source="/Syncfusion.Themes.FluentLight.WPF;component/MSControl/ScrollViewer.xaml"/>

                    </ResourceDictionary.MergedDictionaries>

                    <Style  BasedOn="{StaticResource SyncfusionGridCellStyle}" TargetType="syncfusion:GridCell">

                        <Setter Property="FontSize" Value="20" />

                    </Style>

                </ResourceDictionary>

</syncfusion:SfDataGrid.Resources>


Please find the modified sample in the attachment and let us know if you have any concerns in this.


Regards,

Vijayarasan S


Attachment: ModifiedSample_f6b74d86.zip

Loader.
Live Chat Icon For mobile
Up arrow icon