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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:55:57+00:00 2026-06-07T08:55:57+00:00

I would like to create some XAML that highlights a textbox, when the textbox

  • 0

I would like to create some XAML that highlights a textbox, when the textbox contains text from another textbox. It’s essentially highlighting searched items.

UI:
Here is my UI:

When a user types anything into the Search textbox on the bottom left of the UI, it filters the workstations from the treeview until the only ones left contain the search term in there details. When they then select a treeview item, it populates the details on the right. I’d like if it highlighted the textbox that contains the search term as shown on the workstation name field above.

Here is some of my code:

The textbox with a hardcoded highlight

<StackPanel Grid.Column="1" Grid.Row="0">
    <Border Name="HighlightBorder" Grid.Column="1" Grid.Row="0" CornerRadius="4">
         <Border.Background>
              <RadialGradientBrush RadiusX="1" RadiusY="0.7">
                   <GradientStop Color="Black" Offset="1"/>
                   <GradientStop Color="#FFFFEA00"/>
              </RadialGradientBrush>
         </Border.Background>

         <TextBox Margin="5" Height="32" FontSize="16" Foreground="White" Text="{Binding WorkstationName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
    </Border>
</StackPanel>

The Search Textbox:

<Grid>
     <Grid.ColumnDefinitions>
           <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
     </Grid.ColumnDefinitions>
     <TextBlock Text="Search:" Foreground="White" FontSize="16"/>
     <TextBox Grid.Column="1" Text="{Binding SearchCriteria, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</Grid>

Is there an easy way to only have the border have that gradient background when the textbox contains the string in the search textbox and otherwise, be black? I’d love to have it be a XAML only solution, but I’m not stubborn about it either.

I also think it would be neat to have the background pulse a little, but I can fight to figure out my own animations, I really just need help with my question.

Thanks!

  • 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-07T08:55:59+00:00Added an answer on June 7, 2026 at 8:55 am

    I think you will need a little bit of code in the form of a converter

    public class ContainsSearchTextConverter : IMultiValueConverter
    {
        #region IMultiValueConverter Members
    
        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (values.Any(v => v == DependencyProperty.UnsetValue))
                return null;
    
            var text = values[0].ToString();
    
            var search = values[1].ToString();
    
            if (string.IsNullOrWhiteSpace(search))
                return null;
    
            if (text.Contains(search))
                return "true";
    
            return null;
        }
    
        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    
        #endregion
    }
    

    You then use it like:

        <StackPanel>
            <Border Name="HighlightBorder" Grid.Column="1" Grid.Row="0" CornerRadius="4">
                <Border.Style>
                    <Style TargetType="Border">
                        <Style.Triggers>
                            <DataTrigger Value="true">
                                <DataTrigger.Binding>
                                    <MultiBinding Converter="{StaticResource containsSearchTextConverter}">
                                        <Binding ElementName="workStationNameTextBox" Path="Text" />
                                        <Binding Path="SearchCriteria" />
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter Property="Background" >
                                    <Setter.Value>
                                            <RadialGradientBrush RadiusX="1" RadiusY="0.7">
                                                <GradientStop Color="Black" Offset="1"/>
                                                <GradientStop Color="#FFFFEA00"/>
                                            </RadialGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>
    
                <TextBox Name="workStationNameTextBox" Background="Black" Margin="5" Height="32" FontSize="16" Foreground="White" Text="{Binding WorkstationName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
            </Border>
        </StackPanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have authored some custom classes that I would like to create using XAML:
I would like to create some text on the stage that does not respond
I'm working from a JavaScript book and would like to create some menus using
I create some dynamic textbox's and a button in a placeholder and would like
I would like to create a file which stores some data that can be
I would like to create a caching system that will bypass some mechanisms in
I would like to create some logic with in my Rails app that is
i would like to create some Flex Desktop Application that will be always in
I would like to generate some images dynamicaly. For that, I intend to create
I would like to create some kind of structure to reduce the number of

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.