Wednesday, January 18, 2012

How to set column alignment in silverlight Data Grid?

In Xaml write as below.
<sdk:DataGridTextColumn Binding="{Binding Path=PriceAmt}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="Auto" Header="Price Amount" IsReadOnly="True">
       <sdk:DataGridTextColumn.CellStyle>
         <Style TargetType="sdk:DataGridCell">
            <Style.Setters>
              <Setter Property="HorizontalAlignment" Value="Right"></Setter>
                 <Setter Property="FontWeight" Value="Bold" />
                     </Style.Setters>
                        </Style>
                        </sdk:DataGridTextColumn.CellStyle>
                        
</sdk:DataGridTextColumn>

2 comments: