protected virtual void OnClick() { if (!string.IsNullOrEmpty(ImageCheckedPath + ImageIntermediatePath + ImageCheckedPath)) { ToggleCheckedValue(); } if (IsEnabled) { if (PopupMenu.Click != null) { PopupMenu.Click(this, new RoutedEventArgs()); } if (Click != null) { Click(this, new RoutedEventArgs()); } if (Command != null && Command.CanExecute(CommandParameter)) { Command.Execute(CommandParameter); } } if (CloseOnClick) { PopupMenu.CloseAllOpenMenus(); } }