private void ExecuteCommand(object sender, RoutedEventArgs args) { CommandParameter <object> parameter = new EventCommandParameter <object, RoutedEventArgs>( CustomParameter, RoutedEvent, args); base.ExecuteCommand(parameter); }
public static EventCommandParameter <TCustomParameter, TEventArgs> Cast(object parameter) { var parameterToCast = parameter as EventCommandParameter <object, RoutedEventArgs>; if (parameterToCast == null) { throw new InvalidCastException(string.Format("Failed to case {0} to {1}", parameter.GetType(), typeof(EventCommandParameter <object, RoutedEventArgs>))); } var castedParameter = new EventCommandParameter <TCustomParameter, TEventArgs>( (TCustomParameter)parameterToCast.CustomParameter, parameterToCast.RoutedEvent, (TEventArgs)parameterToCast.EventArgs); return(castedParameter); }