2

I'm trying to remove all handlers assigned to BackKeyPress event using reflection in Windows Phone application. I tried out many solutions, including How would it be possible to remove all event handlers of the 'Click' event of a 'Button'?, but none of them worked in Windows Phone. Once I cannot use EventHandlerList, another time I get System.FieldAccessException. Has anyone run into the same or have a clue how can it be done?

Community
  • 1
  • 1
Richi R.
  • 55
  • 5
  • I guess you don't want to do anything when user press on Hardwarebackbutton, Am I right..? or if not Can you explain your issue much more clear. – Kumar Jul 23 '14 at 05:38
  • I assign new handler to BackKeyPress event in which I block back button (e.Cancel = true) and simultaneously I want to get rid of another handlers to avoid situation that any of them can cause closing app. – Richi R. Jul 23 '14 at 06:55
  • What do you mean that `I want to get rid of another handlers` – Kumar Jul 23 '14 at 07:00
  • Normally you do object.BackKeyPress -= handler, but I do not have a access to "object" so my aim is to delete them by reflection, as far as I presume it is the only way out in this case. – Richi R. Jul 23 '14 at 07:08

0 Answers0