I learned how to trackstand on a mountainbike actually. I started off practicing it on slight inclines (I commuted a few miles to school when I was abroad) and I made sure to stop at every stop sign and every traffic light and tried to keep my balance as long as possible, even if it made me look like an idiot when I'd start to lose my balance. I picked up a fixed gear and I was almost immediately able to trackstand for nearly unlimited amounts of time. I feel like stopping at lights etc helps me to practice a lot.
I've heard the term chocolate foot used a few times here before also I've heard people make reference to it in regards to riding snowboards and or skating. Interesting to know where the term comes from (german).
Also some tips:
Turn your wheel in the same direction as your "chocolate foot". Ideally like 45 degrees, this will make it harder for you to move which should help you stand still.
Also, center your focus on a stationary object no less than ten feet away from you, as this helps you center yourself and will actually make it easier to balance (taught to me by a tight rope walker)