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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:49:07+00:00 2026-05-18T10:49:07+00:00

I have the below XAML which attempts to set the border of all TextBoxes

  • 0

I have the below XAML which attempts to set the border of all TextBoxes in the window to red OnMouseOver. What happens is when the mouse is over the textbox the FontSize and Foreground properties are set but the BorderBrush is only set momentarily before reverting to its previous default value. I want the BorderBrush to stay red until the the mouse is no longer over the textbox. Any ideas why this happens?

<Window x:Class="StylesApp.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">
    <Window.Resources>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Width" Value="250" />
            <Setter Property="Height" Value="50" />
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="FontSize" Value="20" />
                    <Setter Property="Foreground" Value="Red" />
                    <Setter Property="BorderBrush" Value="Red" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>
    <Grid>
        <TextBox>
           My TextBox
        </TextBox>
    </Grid>
</Window>
  • 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-18T10:49:08+00:00Added an answer on May 18, 2026 at 10:49 am

    I assume the TextBox has another animation for the BorderBrush when the IsMouseOver property is set to true. However, this trigger is only active when BorderThickness is exactly 1.0. So to overcome this you can change the BorderThickness to 1.01 or something in the trigger and the BorderBrush will stay Red as long as the mouse is over the TextBox.

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Width" Value="250" />
        <Setter Property="Height" Value="50" />
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderThickness" Value="1.01" />
                <Setter Property="FontSize" Value="20" />
                <Setter Property="Foreground" Value="Red" />
                <Setter Property="BorderBrush" Value="Red" />
            </Trigger>
        </Style.Triggers>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below XAML code : <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml DataContext={Binding RelativeSource={RelativeSource Self}} WindowStartupLocation=CenterScreen
I Have a ResourceDictionary Generic.xaml which consists of a set of other resource dictionaries,
I have the following XAML below for the main window in my WPF application,
I have the below XAML which shows some padding under the buttons in the
I have a list on my WPF xaml which contains two items. Below is
I have a listbox and I have set the itemstemplate as shown below. XAML:
I have below snippet of code in which TestClass is extending jPanel which is
I have below trigger ALTER TRIGGER [dbo].[DeleteUserData] ON [dbo].[site_users] AFTER DELETE AS BEGIN SET
I have a Mediaplayer control on my XAML page like below: <CustomMediaElement:CustomMediaPlayer x:Name=custMediaElement VerticalAlignment=Center
We have some XAML which may seem odd but apparently is needed for defining

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.