I am sorry for my dumb question but I have a class that is an UIView and it has a button that will change the data in my ViewController. How can I access the click button that is in that class so the data in my ViewController can change?
Thank you for your time guys.
You could define an EventHandler in your UIView and invoked in ViewController when you clikc the button .
public event EventHandler ButtonClickEvent;
//...
button.TouchUpInside += Button_TouchUpInside;
private void Button_TouchUpInside(object sender, EventArgs e)
{
EventHandler handler = ButtonClickEvent;
handler?.Invoke(sender, e);
}
yourUIView.ButtonClickEvent += ButtonClickHandler;
private void ButtonClickHandler(object sender, EventArgs e)
{
// change the data here
}
Thank you so much... I tried to use an EventHandler but it wasn't working. I guess I didn't do some things right. Thank you again, that's just what i needed :)