He was speaking at the rededication of a Bradford war memorial desecrated by children earlier this year.
The prince became involved in the project to rebuild the memorial at Cottingley after reading about the vandalism.
He told crowds outside the parish church of St Michael and All Angels how he understood their "anger, resentment and bewilderment".
But he said efforts must be made to stem the alienation of some young people and to "reconnect" the generations.
The prince said the community had "suffered something quite extraordinary in terms of a community almost in a state of shock as a result of what it found when your much-valued war memorial was desecrated."
After the rededication he spent more than half-an-hour on a walkabout, before leaving for Leeds.
Diverse workforce
Earlier, the prince heard how Bradford was attracting a wider range of people into the city's workforce.
During his visit to the Inland Revenue headquarters in Centenary Court the prince met 22 representatives of the business community in the city.
The visit was the second by the prince to Bradford in just over a year.
Last September, shortly after the riots, the prince was told there was a shortage of good quality work placements for young people.
This time the prince heard how the Inland Revenue was one organisation that had been successful in attracting staff through work placements taken up by people from many different backgrounds, including ethnic minorities.