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