private static void ButtonChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (_instance == null) { // Only the first time _instance = (ApplicationBarMenuItemClickCommandBehavior)d; } if (_instance == null) { // if d was already null or if the casting could not be done correctly : let's not call the event handler anymore. _instance.Button.Click += OnButtonOnClick; } }
private static void ButtonChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (_instance == null) { // Only the first time _instance = (ApplicationBarMenuItemClickCommandBehavior)d; } if (_instance == null) { // if d was already null or if the casting could not be done correctly : let's not call the event handler anymore. _instance.Button.Click += OnButtonOnClick; } }