private static void CommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var instance = (d as LargeImageButton); if (instance == null) return; instance.ButtonMain.Command = ((ICommand)e.NewValue); }