> > >
TextBox Enter Button Invoke
Express yourself! Share your work with other members of the Expression Community.

Each contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.

TextBox Enter Button Invoke

Average Rating:  (17)
Description
Discussions (4)

  • I can Handle enter on keyup only not keydown
    1 Posts | Last Post October 27, 2011
    • first of all , thanks very much for that helpful topic 
      I can Handle enter on keyup only not keydown
      when i press enter keydown doesn't fire although it fires with all other keys.
      but when i press enter keyup fires .!!
      do you know why ?
  • How do we do this in WPF
    1 Posts | Last Post August 04, 2011
    • I am trying to do something similar in WPF. How should I modify this for use in WPF
  • Using with two way bindings
    3 Posts | Last Post September 28, 2010
    • Very nice behavior -- thanks for sharing! I did run into one minor snag I thought I would comment about. 
      
      The TextBox I have the behavior attached to has a two-way binding on the text value. When I hit the ENTER key the button click handler correctly executes but the text value of the binding does not update if it has been changed since getting focus. 
      
      For example:
      
      -Focus the TextBox
      -Paste in some text
      -Hit ENTER
      
      I was able to work around this by adding a call to _targetedButton.Focus() right before Invoke() but was curious if there is a better solution.
      
      Thanks again!
      
      Cheers,
      -Chris
    • Hi This is not working in WPF.
      it gives error 
      	A value of type 'TextBoxEnterButtonInvoke' cannot be added to a collection or dictionary of type 'TriggerActionCollection'
      
      
      I have written the following code
       <TextBox Text="{Binding CikSearchString, UpdateSourceTrigger=PropertyChanged}"  HorizontalAlignment="Left" Width="100" MaxLength="10">
                         
                              <interaction:Interaction.Triggers>
                                  <interaction:EventTrigger  EventName="KeyDown"  >
                              <p:TextBoxEnterButtonInvoke   Element="{Binding ElementName=btnSearch}" />
                              </interaction:EventTrigger>
                              </interaction:Interaction.Triggers>
      
                          </TextBox>
                      <Button CM:CommandManager.Command="{Binding SearchCommand}" x:Name="btnSearch"  CM:CommandManager.CommandEventName="Click" Width="75" Height="24" Content="Search"  IsTabStop="True" Margin="3,0"/>
      
      It is not working 
      I am not bale to find the issue.. can u help to fix this issue..
      
      Thanks
      
    • Hi, actually i have implemented as in the sample
           <TextBox Text="{Binding CikSearchString, UpdateSourceTrigger=PropertyChanged}"  HorizontalAlignment="Left" Width="100" MaxLength="10">
                         
                              <interaction:Interaction.Triggers>
                                  <interaction:EventTrigger  EventName="KeyDown"  >
                                  <p:TextBoxEnterButtonInvoke   TargetName="btnSearch" />
                              </interaction:EventTrigger>
                              </interaction:Interaction.Triggers>
      
                          </TextBox>
                      <Button CM:CommandManager.Command="{Binding SearchCommand}" x:Name="btnSearch"  CM:CommandManager.CommandEventName="Click" Width="75" Height="24" Content="Search"  IsTabStop="True" Margin="3,0"/>
      It give the above arror.
      Please any sugestion
  • Good job
    3 Posts | Last Post September 25, 2009
    • I was about to make and publish this same behavior. Nice work. Since you already did it, I'll tell you some features that I had in mind and you could implement:
      
      1 - Put a property to make it possible to to disable the behavior.
      2 - Put a property to tell if the button should be triggered when the textbox is empty.
      
    • Hi,
      Thank you very much for great feedback!! but I believe that behaviors should be simple as they can be. :)
      
      Instead of giving property to disable behaviour, user can detach it.
      
      The same thing is with empty textbox issue. I've thought about what you wrote and I decided that this property should also be not added. Behavior just invoke button, so when user would like to validate when textbox is empty, he should only take care about what happen when button is clicked. My behavior don't call button's method, it only invoke the button :]
      
      PS. When you set IsEnable to false on the button, behavior won’t call button's method (there was a error in this situation but I fixed it).
      
      I hope you agree with me and thank you for your suggestions! 
      Jacek Ciereszko
      
    • It makes sense. Once again, nice work.

Details

Rate it:
 
 
 
 
 
  • Share It:
    E-mail Twitter del.icio.us Digg Facebook
  • Add To Favorites
  • Published: 9/20/2009
  • Tags: Behavior, button, Textbox, Call, Click, Command, Invoke
  • License Information:
    This contribution is licensed to you under a License Agreement by its owner, not Microsoft. Microsoft does not guarantee the contribution or purport to grant rights to it.