If you can, straighten out the knee. If it is stuck and painful to move, stabilize (splint) the knee and get medical attention.
Your health care provider will examine the knee, which could confirm that the kneecap is dislocated.
A knee x-ray and, sometimes, MRIs should be done to make sure that the dislocation did not cause a bone to break or cartilage to be damaged. If tests show that you have no such damage, your knee will be placed into an immobilizer or cast to prevent you from moving it for several weeks (usually about 3 weeks).
After this time, physical therapy can help build back your muscle strength and improve the knee's range of motion.
If the knee remains unstable, you may need surgery to stabilize the kneecap. This may be done using arthroscopic or open surgery.