Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to Align columns header and column content in WPF datagrid?

$
0
0

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.how i can do this?

thanks 

 


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>