From the manual for my Z:
The vehicle must be stopped to engage or disengage 2WD / 4WD and 4WD-LOCK. Mechanical damage may occur if the switch is engaged or disengaged while driving.
I did not find any similar statement in the XC manual but did find this for 4WD-Lock:
"Riding before the front differential is properly engaged (e.g., when the indicator light is flashing) will cause the engine speed to be limited until engagement is complete"
Having said that, I routinely shift to and from 4WD on the Z while moving at slow speeds and it doesn't seem to be a problem. I stop before before putting it into 4WD-lock, which isn't often.