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.
Unfortunately, activation email could not send to your email. Please try again.

Unable to set foreground and fontfamily for data inside grids

Thread ID:

Created:

Updated:

Platform:

Replies:

124795 Jun 30,2016 06:19 AM Jul 1,2016 07:38 AM UWP 1
loading
Tags: SfDataGrid
anil kumar
Asked On June 30, 2016 06:19 AM

Hello,
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:SfDataGrid.Columns>
                            <syncfusion:GridTextColumn HeaderText="Program" MappingName="szProgramName" TextWrapping="Wrap" Width="230">
                                <syncfusion:GridTextColumn.CellStyle>
                                    <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" />
                                    </Style>
                                </syncfusion:GridTextColumn.CellStyle>

                            </syncfusion:GridTextColumn>
etc...

Thanks in advance.

Attachment: SfDataGrid_85e2c265.zip

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

Hi Anilkumar,  
 
Thank you for contacting Syncfusion support.  
 
We have analyzed your query and please find the below details 
 
HeaderStyle:  
  
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,  
  
  
 
CellStyle:  
  
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,  
  
  
  
  
Note:  
  
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.  
 
Regards,  
Elavarasan M

CONFIRMATION

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.

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.

;