Exemple #1
0
 private static void OnSetCommandParameterCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
 {
     Microsoft.Phone.Controls.PhoneApplicationPage buttonBase = dependencyObject as Microsoft.Phone.Controls.PhoneApplicationPage;
     if (buttonBase != null)
     {
         PhoneApplicationPageBackKeyPressCommandBehavior behavior = GetOrCreateBehavior(buttonBase);
         behavior.CommandParameter = e.NewValue;
     }
 }
Exemple #2
0
        private static PhoneApplicationPageBackKeyPressCommandBehavior GetOrCreateBehavior(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
        {
            PhoneApplicationPageBackKeyPressCommandBehavior behavior = buttonBase.GetValue(BackKeyPressCommandBehaviorProperty) as PhoneApplicationPageBackKeyPressCommandBehavior;

            if (behavior == null)
            {
                behavior = new PhoneApplicationPageBackKeyPressCommandBehavior(buttonBase);
                buttonBase.SetValue(BackKeyPressCommandBehaviorProperty, behavior);
            }

            return(behavior);
        }