/// <summary> /// Invokes the specified argument. /// </summary> /// <param name="arg">The argument.</param> protected override void Invoke(object arg) { if (AssociatedObject == null) { return; } #if NET || NETCORE || NETFRAMEWORK var lang = CultureInfo.CurrentCulture; #else var lang = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; #endif // if a trigger parameter converter is specified, then we use that to get the command parameter // else we use the given parameter - note_ the parameter can be null var parameter = TriggerParameterConverter != null ? TriggerParameterConverter.Convert(arg, typeof(object), AssociatedObject, lang) : Parameter; if (parameter == null && UseTriggerParameter) { parameter = arg; } if (Command != null && Command.CanExecute(parameter)) { Command.Execute(parameter); } }
protected override void Invoke(object parameter) { if (this.AssociatedObject == null) { return; } // if a trigger parameter converter is specified, then we use that to get the command parameter // else we use the given parameter - note_ the parameter can be null var _parameter = TriggerParameterConverter != null? TriggerParameterConverter.Convert(parameter, typeof(Object), this.AssociatedObject, CultureInfo.CurrentCulture) : this.Parameter; if (this.Command != null && this.Command.CanExecute(_parameter)) { this.Command.Execute(_parameter); } }