Dating a photo based on a man's hat can lead you to incorrect results.With that said, clothing is one resource for you in identifying the age of a portrait but it is not the only source.Photos taken during the Civil War may have a tax revenue stamp on it.
One photo of my great-great grandfather was finally identified by enlarging it to see the detail of the lapel pins he was wearing.
This site includes an easy to understand history of 19th century photographic techniques, along with photographic examples.
Photo Tree has an archive of 1,000 photos that you can use to compare your photo and help yourself figure out the date a photograph was taken.
Certain types of scenes were popular in different time periods; for example, frontier scenes and landscapes were popular in the 19th century.
Some props may have been the photographers, like books, so don't assume that because your ancestor was posing next to it that it was theirs.