private static void OnVisibilityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue != e.OldValue) { var button = ((BindableAppBarMenuItem)d); BindableAppBar bar = button.Parent as BindableAppBar; bar.Invalidate(); } }