0

I have a user control that contains a textbox and some buttons.

I can't respond to the text changed event from the textbox from outside of that user control (say from the parent form that the control is placed on).

How can I get an event that raised when the text has changed from outside of the user control?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Mamad
  • 446
  • 5
  • 22

2 Answers2

2

Please see this answer on how to create a custom event in WPF.

Following this approach, you can handle the "TextChanged" event for the textbox inside your user control, then raise a custom event from there.

  • 1
    thank you. your answer and this post help me to right solution : https://stackoverflow.com/questions/3486377/how-to-add-an-event-to-a-usercontrol-in-c – Mamad May 21 '18 at 10:05
0

in your textcontrol event change, put this:

 Me.OnTextChanged(e)

Or create your own event

Upper code:

 Public Event ClaveModificada(Causa As String)

and when you need:

RaiseEvent ClaveModificada("")
R.Alonso
  • 989
  • 1
  • 8
  • 9