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

  • Home
  • SEARCH
  • 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 3340156
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:34:30+00:00 2026-05-18T00:34:30+00:00

I would like to modify the control template for the DataGrid (4.0 version) but

  • 0

I would like to modify the control template for the DataGrid (4.0 version) but I am not sure what the existing template looks like. Does anyone know what it is or where I could find it?

In general: For some WPF control, how can I see the default content the respective control template?

  • 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-18T00:34:31+00:00Added an answer on May 18, 2026 at 12:34 am

    I would recommend going into Blend (if you have it) and extracting the Template. Otherwise, you can get the XAML using XAMLWriter.

    This unfortunately named page (I don’t think this is really “Kid’s Stuff”, do you?) has an example of doing both of these things.

    In case the page does happen to go away (2009 is pretty far in the rear-view mirror):

    // Get the template from the control
    YourControlType ctl = new YourControlType();
    ctl.UpdateDefaultStyle();
    ControlTemplate template = ctl.Template;
    
    // We want our xaml of be properly indented, ohterwise
    // we would not be able to indent them.
    XmlWriterSettings xmlSettings = new XmlWriterSettings();
    xmlSettings.Indent = true;
    
    // Make the string builder
    StringBuilder sb = new StringBuilder();
    XmlWriter writer = XmlWriter.Create(sb, xmlSettings);
    XamlWriter.Save(template, writer);
    
    
    // Now the sb.ToString() should give us the template
    

    All credit to Shafqat Ahmed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to modify the NavigateUrl property of a Hyperlink control. I need
I would like to know what are the best practices to manage fixtures of
I have an html5 video that I would like to automatically update with a
I have a number of applications which I cannot modify(no source), they are hard
I need to create a proxy class so i can communicate with a Java
My question is pretty similar to this one . I am working in company
I find myself writing this class often in my python code when I need
Hey, so what I am looking to accomplish is a MySQL query which grabs
I have this stylesheet: @-webkit-keyframes run { 0% { -webkit-transform: translate3d(0px, 0px, 0px); }
I have a DLL (written in C) that uses static thread local storage (

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.