Skip to main content

Microsoft Silverlight

Answered Question DataGrid AutoGenerated Column TextAlignmentRSS Feed

(0)

realdn
realdn

Member

Member

8 points

12 Posts

DataGrid AutoGenerated Column TextAlignment

 HI,

I want to set the  TextAlignment  of a Autogenarated Column. Is it Possible? 

lingbing
lingbing

Contributor

Contributor

2249 points

406 Posts

Answered Question

Re: DataGrid AutoGenerated Column TextAlignment

Hi, you can change the DataGrid's CellStyle to let the content display at where you want. It will be like:

<Grid>
   <Grid.Resource>
       <Style x:Key="MyStyle" TargetType="data:DataGridCell">
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
       </Style>
   </Grid.Resource>
   <data:DataGrid CellStyle="{StaticResource MyStyle}"/>
</Grid>

You can have a try and tell me the result. Regards!

Ling Bing
Bei Jing University of Aeronautics and Astronautics
Bei Jing, China

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Answered Question

Re: DataGrid AutoGenerated Column TextAlignment

You should read this article:

http://msdn.microsoft.com/en-us/library/cc903950(VS.95).aspx

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

realdn
realdn

Member

Member

8 points

12 Posts

Re: DataGrid AutoGenerated Column TextAlignment

thanx lingbing, it works fine.  and also thanx to Nanavaty for the link.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities