First, be sure to have her evaluated medically, to be sure there is no inflammation, irritation, or other physical problem. If all is OK from that perspective, set limits on her behavior in 'public' settings (i.e., in the presence of others), and tell her that such behavior must occur while she is alone. Generally, this turns out to be no problem at
schoolPreschooler development
Preschooler test
Preschooler test or procedure preparation
School age child development
School age test or procedure preparation
School-age children development, because children are otherwise occupied. You'll notice that at home, when your daughter is occupied, she will likely not masturbate.