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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:17:22+00:00 2026-06-04T19:17:22+00:00

I’ve looked around, but can’t specifically find my issue. I know that the default

  • 0

I’ve looked around, but can’t specifically find my issue. I know that the default “Error” handling within WPF puts an “Adorner” around controls in case there are any errors based on IDataErrorInfo or Validataion rules failing a given control. That’s all good and fine, however, with a tabbed page interface, if any controls are so flagged as invalid, they are properly adorned in red border. However, as soon as you go from tab page 1 to 2 and back to 1, all the adorners are gone (bad). This was already asked, and solution accepted, but was looking for a better alternative.

So, I went to my “Themes” declaration, and for the textbox control, I just said to set the entire background color of the control to red and not just the border. Without any fancy forced triggering via Notify on Property Changed, if I swap between pages, the red background of the entire textbox remains constant.

Now, on to the combobox control. For those who have customized their own, or even looked into the default MS version of the control, its actually a clustered mess of controls, grids, columns, buttons, etc to make the magic of combobox work. In brief…

ControlTemplate
Grid (two columns, one for text display of chosen, second column for the drop-down arrow)
Border spanning both columns
Path ( line drawing / glyph for the drop-down image for combobox )

ControlTemplate TargetType Textbox (as part of the entire combobox set)
Border specifically “PART_ContentHost”

ControlTemplate of combobox
Grid
Toggle Button
Dropdown exposed showing list
other triggers..

Finally, the main ComboBox declaration which is templated by above components.

Anyhow, I can’t for the life of me get this. In the “Toggle Button” area of the combobox declaration, I have a trigger to change the background to an OBVIOUS off color for proof of testing the trigger working and in the right location within the ControlTemplate declarations.

So, knowing this is the correct place within the combobox declarations, I want to supersede the green background color with red if there’s an error with the data. I KNOW the overall “Validation.HasError” is properly getting triggered as the native error handler shows. No matter how / where within the template I try to change the background color to red, it does NOT work. I’ve even tried doing DataTriggers, using converters, trying multiple properties, but it appears not to be cooperating.

Any suggestions? This is getting really annoying.

  • 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-04T19:17:24+00:00Added an answer on June 4, 2026 at 7:17 pm

    FINALLY, got it… and not as obvious as I would have guessed. Anyhow, here’s what I’ve found. If you went with a sample from Microsoft’s template of the combobox, they first provide the overall two-column “ToggleButton” declaration

    <ControlTemplate TargetType="ToggleButton" 
       x:Key="baseComboBoxToggleButton" >
    
      ... blah blah...
    
    </ControlTemplate>
    

    Then, the declaration for the “Display Value” of the combobox

    <ControlTemplate TargetType="TextBox" x:Key="ComboBoxTextBox" >
       <Border x:Name="PART_ContentHost" Focusable="False" 
               Background="{TemplateBinding Background}" />
    </ControlTemplate>
    

    Then, tie them together as one Combobox “wrapper” declaration

    <ControlTemplate TargetType="ComboBox" x:Key="ComboBoxGridControlTemplate" >
       <Grid x:Name="GridComboWrapper">
          <!-- This is the dropdown button that POINTS TO THE "baseComboBoxToggleButton at the top -->
          <ToggleButton Name="ToggleButton" 
            Template="{StaticResource baseComboBoxToggleButton}" 
            Grid.Column="2" Focusable="false"
            IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay,
                    RelativeSource={RelativeSource TemplatedParent}}"
                    ClickMode="Press" >
          </ToggleButton>
    
          ...
          rest of the content presenter,
          EDIT(able) textbox area,
          popup area of combobox when in drop-down mode
    
       </Grid> 
    
    
       <ControlTemplate.Triggers>
    
          <!-- PUT THE VALIDATION CHECK HERE -->
          <Trigger Property="Validation.HasError" Value="true">
             <Setter Property="ToolTip" 
                     Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                     Path=(Validation.Errors)[0].ErrorContent}"/>
    
    
             <!-- THIS IS THE CRITICAL COMPONENT... I HAD TO EXPLICITLY TELL
                  The TagetName as the "ToggleButton" and change ITs Background property
                  and it now works -->
             <Setter TargetName="ToggleButton" Property="Background" 
                     Value="{StaticResource BrushDataInvalidBorder}" />
          </Trigger>
    
       </ControlTemplate.Triggers>
    </ControlTemplate>
    

    So, now it works as intended and doesn’t loose any adorner just because the active page on a given form changes and clears it… its static to each individual control as expected… Wow… what a PITA this one was.

    Hope it helps someone ELSE in the future from excessive head banging against a wall while learning this nested level of stuff.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.