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 8402293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:01:06+00:00 2026-06-09T22:01:06+00:00

I would like to make a change to the PART_EditableTextBox of the default wpf

  • 0

I would like to make a change to the PART_EditableTextBox of the default wpf combobox (change the background for example).

I tried adding a style like this:

<Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource {x:Type ComboBox}}">
  <Setter Property="Control.Template">
    <Setter.Value>
      <ControlTemplate TargetType="ComboBox">
        <TextBox x:Name="PART_EditableTextBox" Background="AntiqueWhite"/>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

But that causes the rest of the default template to be ignored.

Is there a way I can just override a specific property of the PART_EditableTextBox or do I have to copy over the entire control template and make my change in there?

  • 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-06-09T22:01:07+00:00Added an answer on June 9, 2026 at 10:01 pm

    Some different ways to change the look of the Control…

    Copying a Controls Template, Editing it and Using it in a Style

    When copying and modify the Template of a control…you have to bear in mind 1 thing…themes.

    The control might have completely different Template designs depending on the theme (i.e. different chrome)…and so your problem is…which template do you choose to copy, modify and then use on your control.

    No matter, which one you choose…you have a problem…when someone is running Windows in a theme that is different to the theme from which you copied the Template from…well that control will look wrong/out of place.

    To see how different Templates can look like in different themes…use ShowMeTheTemplate:

    • http://www.sellsbrothers.com/posts/details/2091

    So to do it properly, you would have to copy and modify the template for each theme (Classic, Luna, Aero, Royale, etc) and do the necessary steps to get your different themed template to get loaded when the theme changes…so that your control is “theme aware”.

    • When overriding WPF templates do I have to override each theme's template separately?

    • http://windowsclient.net/blogs/nidonocu/archive/2008/02/16/wpf-themes-and-control-libraries.aspx

    • http://blogs.windowsclient.net/nidonocu/archive/2008/03/03/wpf-themes-and-control-libraries-part-2.aspx

    Modifying the Visual tree After Template has been applied at runtime

    If you were the author of the control or you create a derived version of a control…then you can wait till the template is applied and then in OnApplyTemplate…you can then hunt for the “Part” in the visual tree, and then modify the visual tree/changes attributes at runtime (i.e. you could change the Background of PART_EditableTextBox).

    However, this doesn’t work if you are relying on implicit styles (as you are), or don’t want to or can’t replace all your controls with the derived version in your XAML.


    Obtaining a Copy of the ControlTemplate at runtime, and modifying the “Part”

    There is another possibility….obtaining the ControlTemplate for a control at runtime…(which will be for the current theme set at the time)….modifying it, then setting it onto the Control.

    The beauty of this is if there are new themes in the system for which you didn’t have prior knowledge of their names (and thus didn’t design a Template for it), then instead of your control Template being picked up from Generic theme (and thus being out of place)….you have a better chance for the look to fit in better with the new theme. But it is a bit of a hack.

    • https://siderite.dev/blog/cloning-wpf-controltemplate.html

    • Define a WPF ControlTemplate at runtime

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

Sidebar

Related Questions

I would like to make an entire inline formset within an admin change form
I would like to change the page names of a ASP.NET site to make
I would like to observe changes in multiple form fields and make a call
I would like make a script using PHP (probably need JS) to send POST
I would like make an extension method for the generic class A which takes
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to make sure my classes are robust - even if they
I would like to make a password and username entry field. And a submit
I would like to make a JSF inputText field into upper case when the
I would like to make my app freeware, but if a user is willing

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.