Abolfazl

Abolfazl

  • NA
  • 184
  • 81.2k

How to Align columns header and content in WPF datagrid?

Jul 13 2015 3:04 PM

Hi
i have create a wpf datagrid with auto generate column as below:

<DataGrid Name="dtg_student" Margin="10" FontStretch="Expanded" AutoGenerateColumns="True"></DataGrid>

i fill it by a table of database as below:

ProjectDatabaseDataContext db = new ProjectDatabaseDataContext();
dtg_student.ItemsSource = db.tbl_Students;

everything is ok but i want to set the columns header and columns content align to center. i can do this on Windows Form Application but i can't in WPF application.please help me to do it?

thanks 

 
 

Answers (1)