This project is read-only.

Transitions + OnBackKeyPress event handler

May 30, 2011 at 10:11 PM
Edited May 30, 2011 at 10:26 PM

Hello,

I am using the default transitions implantation, which is the turnstile transition. I am needing to override the OnBackKeyPress event handler, which is to cancel OnBackKeyPress event whenever there is a popup showing within the page. However, whenever I press the back key when there is a popup displaying, the page still goes back. Here is a sample of the code I am using to override the OnBackKeyPress

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            base.OnBackKeyPress(e);
            e.Cancel = true;
        }

Is there anything I am missing to further prevent the page and it transition from firing? 

Jun 2, 2011 at 4:12 PM

hey dude,

I could you send me your project ? or a cut down sample of what you have so that i can take a look.

One thing i have noticed is that you call the base and then do e.Cancel = true; have you tried doing this before you call the base ??

<Rich />

 

Jun 2, 2011 at 5:14 PM
It was actually a no-brainer fix... haha. Like you suggested, I had the base and e.cancel the wrong waty around :)

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            if (Search.IsOpen)
            {
                Search.Close();

                e.Cancel = true;
            }
            else
                base.OnBackKeyPress(e);
        }

Jun 2, 2011 at 5:19 PM

Nice!

would be great to see the app when you finished it, drop me an email with the details, or if you have any further questions

<R />

Jun 2, 2011 at 5:21 PM

Will do mate! :) Shall let you know when the app is completed... nearly completed anyway.

- Dan