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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:08:05+00:00 2026-05-20T12:08:05+00:00

I have noticed a strange behaviour of TextBox while BorderThickness property is set to

  • 0

I have noticed a strange behaviour of TextBox while BorderThickness property is set to 1 – the focus causes the border to change the color (to something like white).
However, if I set the border thickness to something different than 1, say .99 or 1.01 the problem disappears.

Is it the bug in WPF? Or is it intended?

  • 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-20T12:08:06+00:00Added an answer on May 20, 2026 at 12:08 pm

    This is the default behavior of the Aero style for TextBoxes. To disable it you would need to restyle the TextBox. You can take the default styles from here (see Download Sample).

    In the default Style for TextBoxBase (which TextBox is based on), you will see it uses a ListBoxChrome. This element is defined in the Presentation.Aero assembly and is responsible for rendering the “focused” look. You can simply remove the RenderFocus setting and possibly the RenderMouseOver, or replace it with a Border.

    Then you’d want to include that in your application resources.

    <LinearGradientBrush x:Key="TextBoxBorder"
          StartPoint="0,0" EndPoint="0,20" MappingMode="Absolute">
      <LinearGradientBrush.GradientStops>
          <GradientStop Color="#ABADB3" Offset="0.05" />
          <GradientStop Color="#E2E3EA" Offset="0.07" />
          <GradientStop Color="#E3E9EF" Offset="1" />
      </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    
    <Style x:Key="{x:Type TextBoxBase}" TargetType="{x:Type TextBoxBase}" BasedOn="{x:Null}">
      <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
      <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
      <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorder}" />
      <Setter Property="BorderThickness" Value="1" />
      <Setter Property="Padding" Value="1" />
      <Setter Property="AllowDrop" Value="true" />
      <Setter Property="FocusVisualStyle" Value="{x:Null}" />
      <Setter Property="Template">
          <Setter.Value>
              <ControlTemplate TargetType="{x:Type TextBoxBase}">
                  <Border x:Name="Bd" BorderThickness="{TemplateBinding BorderThickness}"
                          BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"
                          SnapsToDevicePixels="true">
                      <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                  </Border >
                  <ControlTemplate.Triggers>
                      <Trigger Property="IsEnabled" Value="false">
                          <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
                          <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                      </Trigger>
                  </ControlTemplate.Triggers>
              </ControlTemplate>
          </Setter.Value>
      </Setter>
    </Style>
    <Style x:Key="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBoxBase}}" TargetType="{x:Type TextBox}"/>
    

    If you look at the ListBoxChrome class in Reflector (specifically the OnRender method), you can see it will only render the focused look if it’s BorderThickness is “1,1,1,1”.

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

Sidebar

Related Questions

I have noticed a rather strange behaviour in IE. I have a HTML form
I have noticed a strange behaviour when using the command functionality in Silverlight: When
I have noticed a strange piece of behaviour when using MessageDlg and attempting to
I just noticed a strange behaviour in IE7. I have radio buttons with associated
I've noticed a strange behaviour of the live() function in jQuery: <a href=# id=normal>normal</a>
I noticed a strange behaviour in my Import Service today when I tried to
I have noticed strange behavior when using term-mode if I kill word in termmode
Let me start from a real life example: Customer: Alex, just noticed something strange
I have noticed that cURL in PHP returns different data when told to output
I have noticed that some apps like Safari and Mail show a loading indicator

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.