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
  • 704,970
  • 168
  • 1,303
  • 1,425
Mamad
  • 426
  • 5
  • 19

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.

  • 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
  • 896
  • 1
  • 8
  • 8