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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:47:02+00:00 2026-05-23T20:47:02+00:00

I have a search screen with some textboxes and a Search button as the

  • 0

I have a search screen with some textboxes and a Search button as the default. If I type in a textbox and I CLICK the button, everything’s great. But if I press enter within a text box, the button command fires but the binding on whatever text box I was in does NOT fire and so my criteria doesn’t make it to the view model to get filtered on.

I know one fix is to set the bindings on the text boxes to PropertyChanged, but this seems like way overkill. I might have logic in the viewmodel doing stuff and I don’t want that to trigger on every single keystroke.

What I really want is a way for the button itself to either trigger a focus change or somehow trigger binding. Or to have the textbox trigger binding if focus is lost OR I press enter OR a command is executed from anywhere

  • 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-23T20:47:02+00:00Added an answer on May 23, 2026 at 8:47 pm

    One way to do this is with a BindingGroup.

    http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.bindinggroup.aspx

    If your TextBox(es) and Button are both contained within a Grid (for example), you would add a BindingGroup like this:

    <Grid>
        <Grid.BindingGroup>
            <BindingGroup Name="bindingGroup1"/>
        </Grid.BindingGroup>
    

    Then you could add a Click event handler to your button and call CommitEdit() on the BindingGroup (which the Button and TextBox inherit from the Grid):

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        (sender as FrameworkElement).BindingGroup.CommitEdit();
    }
    

    The Button.Click event fires before the CommandBinding, so any databound TextBox or any other databound controls within that BindingGroup should be updated before your view model command gets executed.

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

Sidebar

Related Questions

I have a search box that doesn't have a submit button, I need to
We used to have a search, that checks two columns for some words. Both
I can't figure this out. Some apps have an EditText (textbox) with the help
I have a search screen in a Visual Basic .Net App that has text
Suppose I have a search screen that is intended for looking up items. There
I have a VB6 application with a search screen. On the search, I have
i have a input tag which is non editable, but some times i need
I have search in MSDN and I can't figure where are the POST parameters
I have a search form with a query builder. The builder is activated by
I have a search form in an app I'm currently developing, and I would

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.