It was one of the couple’s final public engagements before they quit royal life later this month.