Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6539401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:51:19+00:00 2026-05-25T10:51:19+00:00

I am new to WPF, am developing using C# and .NET3.5. I have a

  • 0

I am new to WPF, am developing using C# and .NET3.5. I have a WPFToolkit’s DataGrid added to my window. I am not able to figure out how to set Style to the Column Header and Rows? Rows are added dynamically.

        <my:datagrid name="myGrid" xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit" itemssource="{Binding }" autogeneratecolumns="False">
                 SelectionMode="Extended" SelectionUnit="FullRow" CanUserReorderColumns="False" 
                 ColumnHeaderHeight="42" Background="#FFF7F7F7" BorderBrush="Transparent" 
                 HorizontalGridLinesBrush="#FFEAEAEA" VerticalGridLinesBrush="#FFEAEAEA" 
                 HeadersVisibility="Column" RowHeaderWidth="0" HorizontalContentAlignment="Center" 
                 VerticalContentAlignment="Center" ClipboardCopyMode="None" MinRowHeight="28" 
                 Rowremoved="#FFF7F7F7" RowDetailsVisibilityMode="Visible" RowHeight="28" 
                 DataContextChanged="serverGrid_DataContextChanged">
        <my:datagrid.columns>
            <my:datagridtextcolumn header="Enabled" width="120" binding="{Binding Path=Name}" />
            <my:datagridtextcolumn header="Enabled" width="70" binding="{Binding Path=Country}" />
            <my:datagridtextcolumn header="Enabled" width="100" binding="{Binding Path=Description}" />
        </my:datagrid.columns>

    </my:datagrid>

In the Resources have added code for Style :

    <!-- DataGridColumnHeader-->
    <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type Thumb}">
        <setter property="Background" value="#9DCFD0" />
        <setter property="FontFamily" value="Arial Rounded MT" />
        <setter property="FontSize" value="14" />
        <setter property="FontWeight" value="Bold" />
        <setter property="Foreground" value="#00545B" />
        <setter property="VerticalContentAlignment" value="Center" />
        <setter property="HorizontalContentAlignment" value="Center" />
    </Style>

In TargetType of Style, am not able to set as my:DataGridColumnHeader or just DataGridColumnHeader. It says “… not found”. In my:DataGridTextColumn I guess HeaderStyle is the property to set the style. But am able to define Style for the same.

Also how to set style for Rows added dynamically? Where am I going wrong?
Any help is highly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:51:20+00:00Added an answer on May 25, 2026 at 10:51 am

    you can do like this:

    First is the namespace to header:

    xmlns:Custom="http://schemas.microsoft.com/wpf/2008/toolkit"
    

    then this is style:

    <Style x:Key="DataGridColumnHeaderStyle" TargetType="{x:Type Custom:DataGridColumnHeader}">
            <Setter Property="HorizontalAlignment" Value="Center"></Setter>
            <Setter Property="Foreground" Value="#654b24"></Setter>
            <Setter Property="FontWeight" Value="bold"></Setter>
            <Setter Property="Height" Value="30"></Setter>
            <Setter Property="Background">
                <Setter.Value>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#f7f3de" Offset="0.1"/>
                        <GradientStop Color="#Fcfcfc" Offset="1"/>
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to WPF and I'm trying to figure out how to get the
i'm developing an application (wpf) that have 3 windows. in the main window user
I'm developing WPF applications using MVVM pattern. I have ViewModel with code like this:
I am currently developing a new WPF application and have the majority of my
I am developing an application in WPF using the MVVM pattern. If I have
i am developing a project (WPF) and i have a Datagrid the load more
I have recently joined a new developing project building a thick client application using
I am developing an application using WPF/MVVM. I have a WCF data service project
I am developing a WPF application (using MVVM) and have implemented IDataErrorInfo on my
HI, I am developing an editor using RichTextBox in WPF, i have to implement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.