I need to create hyperlinks in a WPF4 DataGrid control (they appear in columns of type DataGridHyperlinkColumn). I have many DataGrids in the project and would like to apply a hyperlink style for all of them.
I found this Q & A: WPF Style DataGridHyperlinkColumn and created a style for managing HyperLink:
<Style TargetType="{x:Type Hyperlink}"> <Setter Property="TextDecorations" Value="" /> </Style>
It works great, but obviously it also affects all other hyperlinks, for example. in
<TextBlock> <Hyperlink NavigateUri="http://www.google.co.in">Click here</Hyperlink> </TextBlock>
How do I target only hyperlinks in DataGrids? In CSS syntax, it will be something like
DataGrid Hyperlink {TextDecorations: ""; }
source share