Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Title for datagrid

Tags:

c#

wpf

datagrid

How can I able to put a title to my datagrid in WPF . All I can do is style my column headers but putting a title for my whole table is impossible for me. Can anyone help me out. Here's the image of the table I want to have.

enter image description here

like image 393
Kuriyama Mirai Avatar asked Jun 27 '26 18:06

Kuriyama Mirai


1 Answers

here is a sample

<DockPanel LastChildFill="True">
    <TextBlock Text="Details per Check Type"
               Background="Red"
               Foreground="White"
               FontSize="20"
               FontWeight="SemiBold"
               TextAlignment="Center"
               DockPanel.Dock="Top" />
    <DataGrid />
</DockPanel>

above example use a DockPanel as the main container and a TextBlock on the top as the heading and DataGrid in rest of the area.

I give a sample style, you may style the header as desired

like image 159
pushpraj Avatar answered Jun 29 '26 06:06

pushpraj



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!