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

Unable to set foreground and fontfamily for data inside grids

Thread ID:





124795 Jun 30,2016 10:19 AM UTC Jul 1,2016 11:38 AM UTC UWP 1
Tags: SfDataGrid
anil kumar
Asked On June 30, 2016 10:19 AM UTC

I am using below code to apply styling for the data inside grids. But it's not working. please refer the screen shot for the output. I tried using CellStyle aswell but no luck.  Please let me know the correct process as I am very new to this.

<syncfusion:SfDataGrid x:Name="dataProgramGrid" AutoGenerateColumns="False"  SelectionMode="Multiple" SelectionUnit="Row"
                               ItemsSource="{Binding objReportActiveProgramsSurveyData}"   HeaderStyle="{StaticResource headerStyle}" >
                            <syncfusion:GridTextColumn HeaderText="Program" MappingName="szProgramName" TextWrapping="Wrap" Width="230">
                                    <Style TargetType="syncfusion:GridCell">
                                        <Setter Property="Foreground" Value="#505050" />
                                        <Setter Property="FontFamily" Value="Segoe UI" />
                                        <Setter Property="FontSize" Value="10" />
                                        <Setter Property="FontWeight" Value="SemiBold" />


Thanks in advance.

Attachment: SfDataGrid_85e2c265.zip

Elavarasan M [Syncfusion]
Replied On July 1, 2016 11:38 AM UTC

Hi Anilkumar,  
Thank you for contacting Syncfusion support.  
We have analyzed your query and please find the below details 
You have write the style to GridHeaderCellControl and set that style to HeaderStyle. In that style, you have set the HorizontalAlignment and VerticalAlignment as Center, so the borders are not arranged as you expected. We suggest you to set the HorizontalContentAlignment and VerticalContentAlignment as center instead on setting HorizontalAlignement and VerticalAlignment.  
You can refer the below UG documentation to know more about the HeaderStyle,  
We have applied the style to the GridCell based on your code example and we are able to set the foreground, fontfamily to the cells as expected. We have attached the sample for this and please find the sample from below,  
You can refer the below UG documentation to know more about the CellStyle,  
We suspect that you have set the style for Text Block  in your application or themes applied then, Foreground and FontFamily will not be changed based in GridCell foreground because GridCell loads TextBlock as its content. However, you can overcome this problem by setting TextBlock style inside GridCell.Resources.    
Still if you are facing the problem then Could you please modify and revert the sample to us based on your scenario, this will help us to provide the better solution to you.  
Elavarasan M


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

This page will automatically be redirected to the 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