first my problem was the buy button stayed grey all the time.
didnt matter what item i was trying to buy or how many, the buy button did not work.
now the solution.
exit game, right click your gw2 icon and click open file location.
right click on the gw2 launcher, go to properties, compatibility tab. then at the bottom run this program as administrator.
save it and run the game from that icon to see if it worked.
hope this helps.
(to be on the safe side i always delete my old desktop shortcut and replace it with a new one after changing the original file)