引用:
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
样式 (例如右对齐):
<Style x:Key="RightAlignCell" TargetType="data:DataGridCell">
<Setter Property="HorizontalContentAlignment" Value="Right"/>
</Style>
应用此样式到DataGridTextColumn的CellStyle属性:
<data:DataGrid Margin="30,0,5,5" x:Name="dgDummy" AutoGenerateColumns="False" CellStyle="{StaticResource RightAlignCell}">
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Mitgliedsart" Binding="{Binding col1}"/>
<data:DataGridTextColumn Header="Anzahl" Binding="{Binding col2}" CellStyle="{StaticResource RightAlignCell}"/>
</data:DataGrid.Columns>
</data:DataGrid>