Lots of persistence. When we're out with dd if she wants to come out of her stroller, I tell her that if she comes out she must either hold on to the stroller or hold on to mommy or daddy's hand. If she doesn't, then she goes back in the stroller. So then I'll take her out and if she's trying to get away, I'll remind her that she has to hold on or go back into the stroller as it's not safe to walk alone. If she breaks away, then she goes back in the stroller (usually accompanied by lots of protestations) -- I make sure I tell her that I understand that she doesn't want to go back in the stroller, but it's mommy's job to keep her safe, etc, etc. Also, I often let her guide me around when we're out -- generally letting her decide where to go (even if it's with some guidance from me) makes things easier as well.