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

Cell style: set Underlined text

Thread ID:

Created:

Updated:

Platform:

Replies:

141893 Jan 9,2019 04:48 PM UTC Jan 11,2019 10:15 AM UTC WPF 3
loading
Tags: SfDataGrid
Sauro Rossi
Asked On January 9, 2019 04:48 PM UTC

Good evening,
Is possible to set a Underline FontStyle in a WPF SFDatagrid cell ?
I'm able to set FontWeight, FontStyle , ... but I'm not able find the Underline style. 

Thanks and Regards
Sauro

<Syncfusion:GridTemplateColumn Width="75" MappingName="LapValueDataDrvList[0].LapValueData" TextAlignment="Right" >
<Syncfusion:GridTemplateColumn.CellStyle>
 <Style TargetType="Syncfusion:GridCell">
                     <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=ValueXYZ}" Value="1">
                                    <Setter Property="FontStyle" Value="Italic" />      <!-- this works fine -->
                                    <Setter Property="FontStyle" Value="Underline" />      <!-- It doesn't exist -->
                                </DataTrigger>
                      </Style.Triggers>
 </Style>
</Syncfusion:GridTemplateColumn.CellStyle>
 <Syncfusion:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                         ................
                        </DataTemplate>
</Syncfusion:GridTemplateColumn.CellTemplate>                         
 </Syncfusion:GridTemplateColumn>

Jayaleshwari N [Syncfusion]
Replied On January 10, 2019 12:11 PM UTC

Hi Sauro,  
  
Thanks for contacting Syncfusion Support.  
  
We have analyzed your query “Underline not work with CellStyle” from our side. You can able to set underline for GridColumns text by using GridColumn.TextDecoration property. But it will not work for GridTemplateColumn. And we have internally used the DisplayElement as a content control for GridTemplateColumn, and the cell template loaded content  is added as a child of the content control and it will be showing on the UI.   
  
You can achieve your requirement Underline text for TextBlock by using the below code snippets.  
  
<syncfusion:GridTemplateColumn HeaderText="Order ID TEMP" MappingName="OrderID">  
    <syncfusion:GridTemplateColumn.CellTemplate>  
        <DataTemplate>  
            <TextBlock Text="{Binding OrderID}" >  
                <TextBlock.Style>  
                    <Style>  
                        <Style.Triggers>  
                            <DataTrigger Binding="{Binding Path=OrderID}" Value="1000">  
                                <Setter Property="TextBlock.FontStyle" Value="Italic" />  
                                <Setter Property="TextBlock.TextDecorations" Value="Underline"/>  
                            </DataTrigger>  
                        </Style.Triggers>  
                    </Style>  
                </TextBlock.Style>  
            </TextBlock>  
        </DataTemplate>  
    </syncfusion:GridTemplateColumn.CellTemplate>  
</syncfusion:GridTemplateColumn>  
 
We have attached the sample for your reference and you can download the same from the following location. 
  
you can refer the following user guide documentation for TextDecorations property 
  
Regard,  
Jayaleshwari N. 


Sauro Rossi
Replied On January 10, 2019 03:58 PM UTC

Hi Jayaleshwari,
Thanks for your answer. Suggested approach works perfectly in my scenario.

Regard,
Sauro

Jayaleshwari N [Syncfusion]
Replied On January 11, 2019 10:15 AM UTC

Hi Sauro, 
 
Thanks for the update. Please get in touch if you would require for further assistance. 
 
Regards, 
Jayaleshwari N. 


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.

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

;