Conditional TextDecoration in Row
I have a requirement to use strikethrough text across the entire row when the object's IsDeleted property is set. I have reviewed everything I can find on this topic. I understand that GridCell does not have TextDecorations. I know I can use syncfusion:GridTemplateColumn with a TextBox to achieve this, but then I lose all the niceness of the different Syncfusion grid column types.
Is there a way other than to use GridTemplateColumn for all columns that will achieve this?
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
DM
Dhanasekar Mohanraj
Syncfusion Team
December 29, 2020 11:41 AM UTC
Hi Brian Bell,
Thank you for using Syncfusion controls.
You can achieve your requirement with the exact way can you please share what are the difference did you Feel with GridTemplateColumn. We have prepared the sample for the same,
Sample link: https://www.syncfusion.com/downloads/support/forum/160995/ze/Localization_DG-1996232449
Please check the sample and let us know if you are still facing the difficulties? If yes,please modify the sample based on your requirement and revert us back.
Regards,
Dhanasekar Mohanraj.
Dhanasekar Mohanraj.
BB
Brian Bell
December 29, 2020 04:31 PM UTC
Your example doesn't fulfill the requirement that the strikethrough is conditional on IsDeleted. Here is the output of your example:

To fulfill the requirement, only Maria Anders, Christina Berglund, and Frederique Citeaux would display with strikethrough.
DM
Dhanasekar Mohanraj
Syncfusion Team
December 30, 2020 08:53 AM UTC
Hi Brian Bell,
Thank you for your response.
We have modified the sample based on IsDeleted property the Country column have strikthrough appearance with GridTemplateColumn like below,
|
<syncfusion:SfDataGrid x:Name="dataGrid"
AutoGenerateColumns="False" ItemsSource="{Binding Orders}" >
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn HeaderText="Order ID" MappingName="OrderID" />
<syncfusion:GridTextColumn HeaderText="Customer Name"
MappingName="CustomerName"
TextDecorations="StrikeThrough"
TextTrimming="WordEllipsis"
TextWrapping="Wrap" />
<syncfusion:GridTemplateColumn MappingName="Country">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Country}"
TextTrimming="WordEllipsis"
TextWrapping="Wrap"
Padding="5"
VerticalAlignment="Center"
TextDecorations="{Binding Converter={StaticResource textConverter} }" />
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
<syncfusion:GridTemplateColumn.EditTemplate>
<DataTemplate>
<TextBox Text="{Binding Country, Mode=TwoWay}" />
</DataTemplate>
</syncfusion:GridTemplateColumn.EditTemplate>
</syncfusion:GridTemplateColumn>
<syncfusion:GridTextColumn HeaderText="Customer ID" MappingName="CustomerID" />
<syncfusion:GridTextColumn HeaderText="ShipCity" MappingName="ShipCity" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid> |
We have modified the sample,
Sample link: https://www.syncfusion.com/downloads/support/forum/160995/ze/Localization_DG_(2)-2045848845
Screenshot:
Note:
1. CustomerName column is a GridTextColumn has TextDecorations property for all rows
2. Country column is a GridTemplateColumn has TextDecorations property set based on IsDeleted property.
Please check the sample and let us know if you are still facing the difficulties? If yes, please modify the sample based on your requirement and revert us back.
Regards,
Dhanasekar Mohanraj.
Marked as answer
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
BB Brian Bell
- Dec 28, 2020 07:19 PM UTC
- Dec 30, 2020 08:53 AM UTC