What’s the best way to keep my leg still when riding? I find they swing slightly when I’m trotting and cantering

You can ride with no stirrups amd another thing my trainers made me do to fix this on me was hay string and tie the stirrup to the girth so you cant move your legs. This really helped for me!
Ride with no strriups :))
No stirrup work!
As many people have said, no stirrup work works best!
No stirrup work always helps! As well as keeping your upper thigh on and keeping the weight in the balls of your feet and always heels pushing down!
Try practicing by standing up in the saddle at the trot and canter
I agree with @katedewind. No stirrup work will encourage a better position and I find that it can sometimes be a little bit easier than riding with stirrups (as in your legs will more naturally be in the position they should be). Also you can get someone to film you ride so you can see what you need to improve on. Then you can have a solid ride where you can just think about what you need to fix. Sorry if this doesn’t really make sense! 🙂
What I do is tie my stirups to my girth with twine for 5 rides. It hurts ur feet at the beginning but it’s only because ur feet aren’t used to it. What it does is it tells ur brain to keep your feet in one spot
I recommend doing a lot of no stirrup work. When you take your stirrups completely off the saddle, you will feel yourself using more of your seat. Remember to use your inner calves and not as much spur. As you are working your horse with no stirrups, you will feel that your legs won’t be moving, since your seat is working. Hope this helps answet your question!