Stroller stroller stroller. She isn't old enough to understand that we can run in the library or go outside with out and adult yet so you need to put her in something that won't allow her to get up and run around. Then it's baby steps. What I mean is, she has to stay in the stroller the whole time you are out and about for say a week. Then the next week she has to sit in it but after a few mins she is allowed out and you must tell her she has to stay next to you, no running around, etc and if she does, she is back in the stroller. The minute she is off, back in the stroller she goes for the remainder of the day. The next time you are out, same thing. She will get the idea. Same with being out to eat, put her in one of those highchair (not a booster seat). You have to teach her the limits of running around, where to run around and proper behaviour out in public, and you'll have to do it over and over and over till you feel like a broken record. My son will be 3 in a few weeks and he is allowed to stand on the front of the cart at the store as long as he follows the rules-he doesn't get down, he stands up straight and both hands/feet stay on the cart. He gets 3 warnings and then he has to sit in the seat. I don't care if he screams his head off saying he'll walk, he'll be good, blah blah blah (and that is what he does too), I don't let him out of the cart. And he remembers these things because the next time we are at the store he tells me that he won't get down and he does better for longer.
You just have to set the rules, limits when she is with you and stick to them. Tell her she is to stay at the park and if she trys to go out of the fence you are leaving. When she goes for the fence, it's time to call it a day. After a few more times of that, you can start to give her warnings before you leave.
Good luck!
S.