I have some problems with getting the RefreshRequested event to work in one of my ViewControllers that implements the DialogViewController:
public CustomViewController () : base (null, true) {
RefreshRequested += delegate {
...
ReloadComplete ();
};
}
I am calling the CustomViewController from another ViewController like this:
var dvc = new CustomViewController();
this.ActivateController(dvc);
The error message I get is “Toplevel exception: System.ArgumentException: You should set the handler before the controller is shown”
Any pointers of what I am doing from here? Thanks
It looks like you do not have a
RootElementspecified, i.e. it’s set tonullby your own constructor, so you get warned that the internal state is not ready to set the event.You should create an empty
RootElementwith your constructor and, later, add stuff to it (using the property). That should allow you to set the event in your own constructor. E.g.In doubt you can always see the entire source code MonoTouch.Dialog in it’s github repository.