Ask a Neurologist and Get an Answer ASAP
Clearly there are nerves involved as this is how the pain is transmitted from the leg to the brain. It is not likely to be related to your prostatectomy if this did not bother you before.
If this is persistent or progressive you would want to have the leg examined and probably get an X ray of the hip as well
Conditions of the hip, some serious, can present as pain in the upper front part of the leg, particularly when walking or crossing the legs.
i have had the leg examined by my GP. An xray of my hip showed slight wear. Why would the pain go away immediately walking stops and recommence when walking starts again. The last observation should give a strong indication of the cause of the problem.
I have seen several cases of avascular necrosis or occult fracture in a hip that otherwise showed only "slight wear" on X-ray.
In these cases, there was no pain unless and until weight- bearing. So don't be too comfortable with this xray result if you are continuing to have pain when you walk.
I would advise that you ask your doctor about a CT or MRI to get more detailed information about the leg.