Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Custom Datagrid Cell Content?

$
0
0

I have datagrid where I would like to have the cell content look like engraved text.

This is basically two labels. One black and one white where the white is marginally offset to give the appearance of engraved text in a datagrid cell.

I have attempted to use a custom cell style to accomplish this effect:

<Style x:Key="GridCellStyle" TargetType="DataGridCell"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type DataGridCell}"><ContentControl><ContentControl.Content><Grid><Label Padding="0" Content="{TemplateBinding Content}" Margin="1,1,0,0" Foreground="White"/><Label Padding="0" Content="{TemplateBinding Content}" Margin="0" Foreground="Black"/></Grid></ContentControl.Content></ContentControl></ControlTemplate></Setter.Value></Setter></Style>

but, it just gets ignored and the datagrid only shows the default style of text.

Can anyone post an example showing how this would be done in xaml?


Viewing all articles
Browse latest Browse all 18858

Trending Articles