How can I apply a data-driven style to show a strikethrough (or strikeout) style to an entire row?
Depending on a column value, I can succesfully apply font styling such as italic and colour (both font styles) but how to do strikethrough which is a text decoration?
Depending on a column value, I can succesfully apply font styling such as italic and colour (both font styles) but how to do strikethrough which is a text decoration?
8 Answers, 1 is accepted
0
Accepted
Hello jas,
If you want to strike through the text blocks you should be able to do it the same way you apply bold and italic. If you want however to strike through the whole row you can always dray a line on top of the row and show it when the row passes your conditions.
Attached I am sending you a sample achieving the latter.
Sincerely yours,
Kalin Milanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
If you want to strike through the text blocks you should be able to do it the same way you apply bold and italic. If you want however to strike through the whole row you can always dray a line on top of the row and show it when the row passes your conditions.
Attached I am sending you a sample achieving the latter.
Sincerely yours,
Kalin Milanov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

jas
Top achievements
Rank 1
answered on 22 Mar 2010, 12:44 PM
Thank you for such a complete answer!
jas
jas
0

Markus Wolff
Top achievements
Rank 1
answered on 22 Sep 2010, 04:31 PM
Kalin, you mentioned TextDecorations may be applied the same way as FontStyles. I tried the following which works with Foreground and Background but not with TextDecorations, what am I missing? I'm currently using Rad Controls for WPF Version 2010.1.422.35
This works:
This doesn't:
Any suggestions?
This works:
<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding Path=IsDeleted}"
Value
=
"True"
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"Foreground"
Value
=
"Red"
/>
</
DataTrigger.Setters
>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
This doesn't:
<
Style
TargetType
=
"{x:Type telerik:GridViewCell}"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding Path=IsDeleted}"
Value
=
"True"
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"TextDecorations"
Value
=
"Strikethrough"
/>
</
DataTrigger.Setters
>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
Any suggestions?
0
Hi Markus Wolff,
The reason for the second style not to work is that GridViewCell does not have a TextDecorations Property.
The workaround would be :
Place a textblock inside the cell using the CellTemplate property. Target this textblock with the style .
Let me know in case you have troubles/questions while implementing this.
Best wishes,
Pavel Pavlov
the Telerik team
The reason for the second style not to work is that GridViewCell does not have a TextDecorations Property.
The workaround would be :
Place a textblock inside the cell using the CellTemplate property. Target this textblock with the style .
Let me know in case you have troubles/questions while implementing this.
Best wishes,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

Chuck
Top achievements
Rank 1
answered on 17 May 2017, 03:44 PM
Could you please show an example of how that would work? Thanks.
0
Hello Chuck,
Attached to my reply you will find a sample project that implements the approach suggested by my colleague with the current version of the controls. What I've done is to edit the control template of the GridViewRow element and introduce a rectangle inside, which is bound to a property of the underlying data object. I've then set this new style as the RowStyle of the respective RadGridView control.
Do let me know whether such an approach would work for you.
Regards,
Dilyan Traykov
Telerik by Progress
Attached to my reply you will find a sample project that implements the approach suggested by my colleague with the current version of the controls. What I've done is to edit the control template of the GridViewRow element and introduce a rectangle inside, which is bound to a property of the underlying data object. I've then set this new style as the RowStyle of the respective RadGridView control.
Do let me know whether such an approach would work for you.
Regards,
Dilyan Traykov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0

Chuck
Top achievements
Rank 1
answered on 23 May 2017, 12:02 PM
Dilyan, thanks for the sample. I was actually trying to achieve strikethrough of the individual text contents of each row cell, rather than drawing a line across the entire row. Is there a way to apply a strikethrough text decoration of cell contents via a style?
0
Hello Chuck,
In such case, you can define the following style targeting the GridViewCell element:
You can specify a key for this style and set it as the CellStyle for the columns you wish to apply it to.
Do let me know if this provides the desired result.
Regards,
Dilyan Traykov
Telerik by Progress
In such case, you can define the following style targeting the GridViewCell element:
<
Style
BasedOn
=
"{StaticResource GridViewCellStyle}"
TargetType
=
"telerik:GridViewCell"
>
<
Style.Resources
>
<
Style
TargetType
=
"TextBlock"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding Path=IsDeleted}"
Value
=
"True"
>
<
DataTrigger.Setters
>
<
Setter
Property
=
"TextDecorations"
Value
=
"Strikethrough"
/>
</
DataTrigger.Setters
>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
Style.Resources
>
</
Style
>
You can specify a key for this style and set it as the CellStyle for the columns you wish to apply it to.
Do let me know if this provides the desired result.
Regards,
Dilyan Traykov
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.