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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:03:28+00:00 2026-05-26T10:03:28+00:00

<Window x:Class=AiweeeTest.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350 Width=525> <Grid> <Grid.Resources> <SolidColorBrush x:Key=backcolorType Color=Red></SolidColorBrush> <SolidColorBrush x:Key=forecolorType

  • 0
<Window x:Class="AiweeeTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.Resources>
            <SolidColorBrush x:Key="backcolorType" Color="Red"></SolidColorBrush>
            <SolidColorBrush x:Key="forecolorType" Color="Green"></SolidColorBrush>
            <Style x:Key="TextboxStyle" TargetType="{x:Type TextBox}">
                <Setter Property="Background" Value="Yellow"/>
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Background" Value="{StaticResource backcolorType}"/>
                        <Setter Property="Foreground" Value="{StaticResource forecolorType}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <TextBox Name="textbox1" Width="100" Height="25" Style="{StaticResource TextboxStyle}" IsEnabled="False"/>
    </Grid>
</Window>

I am not able to update the background of a textbox using the trigger defined above, however when I copy the entire textbox control template template and replace the “DisabledBackgroundBrush” with my own color it does. What’s the difference, I’ve already seen some links over this matter; however I am not able to understand the reason behind it. As I understand, Triggers are fired in the order they are defined, then the trigger defined locally in the window should be able to override the background color of the textbox when disabled. Please clarify.

PS: I am not trying to achieve anything special here, but just want to understand why is this so. This gives me a bit of frustration of WPF not being intuitive for situations like such.

  • 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-26T10:03:29+00:00Added an answer on May 26, 2026 at 10:03 am

    I am guessing it has something to do with the order in which WPF will apply values for a DependencyProperty. This MSDN article has some good information on Dependency Property Precedence

    Basically the order goes:

    1. Property system coercion
    2. Active animations, or animations with a Hold behavior.
    3. Local value
    4. TemplatedParent template properties
    5. Triggers from the TemplatedParent template
    6. Property sets (typically through XAML attributes) in the TemplatedParent template
    7. Implicit style
    8. Style triggers
    9. Template triggers
    10. Style setters
    11. Default (theme) style
    12. Active triggers in the theme style
    13. Setters in the theme style
    14. Inheritance
    15. Default value from dependency property metadata
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application with the main Window class called MainWindow. Since I
When creating a window class for use with a DialogBox you need to specify
I have a basic Window class that I need to have events such as
Can Any body tell why window class library can't be added in the silverlight
I've got a custom window class that is a couple levels down extending a
I'm trying to hide window after its startup. I have own window-class which is
How do I create a button control (with CreateWindow of a BUTTON window class)
I have this code: public class Window extends JFrame { public Window(){ ... JButton
Imagine I have a class Window with a member function show which causes the
We have this situation: Window Keyboard ^ ^ | / ApplicationWindow so class Window

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.