/// <summary> /// Initializes a new instance of the RelayCommand class. /// </summary> /// <param name="toClone">The command to copy.</param> /// <remarks>Some members (ToolTipIcon, BlockWhenAppIsBusy, UseXamlResource) are not cloned, but unsure why. If these are oversight, we could just /// use MemberwiseClone() instead.</remarks> protected VisualRelayCommand(VisualRelayCommand toClone) : base(toClone) { Name = toClone.Name; MenuItemName = toClone.MenuItemName; ContextMenuItemName = toClone.ContextMenuItemName; ToolTip = toClone.ToolTip; ToolTipTitle = toClone.ToolTipTitle; ToolTipDescription = toClone.ToolTipDescription; Weight = toClone.Weight; SmallIcon = toClone.SmallIcon; LargeIcon = toClone.LargeIcon; Visual = toClone.Visual; MenuItem = toClone.MenuItem; VisualParent = toClone.VisualParent; MenuParent = toClone.MenuParent; KeyboardShortcutKey = toClone.KeyboardShortcutKey; KeyboardShortcutModifiers = toClone.KeyboardShortcutModifiers; PreferredParameterType = toClone.PreferredParameterType; Initialize(); }
/// <summary> /// Creates a copy of the command. /// </summary> /// <returns>A copy of the command.</returns> public VisualRelayCommand Clone() { var clone = new VisualRelayCommand(this); return(clone); }