Hi,
I'm new to WPF, Can someone tell me how to align my datagrid cell text in center.
Currently am using
Windows 8 64-bit operating system
Microsoft Visual Studio 2012
Microsoft .NET Framework Version 4.5
I tried solving using few codes by googling but i failed. One of the code is pasted below,
<Style x:Key="RightCellStyle" TargetType="{x:Type Custom:DataGridCell}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Custom:DataGridCell}">
<Grid Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Right" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Am getting an error saying as mentioned below,
a value of type 'Style' cannot be added to a collection or dictionary of type 'uielementcollection'
a value of type 'Setter' cannot be added to a collection or dictionary of type 'uielementcollection'
a value of type 'ControlTemplate' cannot be added to a collection or dictionary of type 'uielementcollection'