1
Answer

How to Align columns header and content in WPF datagrid?

Abolfazl

Abolfazl

9y
697
1

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)