From my understanding expanding foam is the answer. If the foam willcome in contact with the double glazed frame, then you should use a window foam filler, so that is does not react with the frame.
Use a search engine to Check out foam fillers types and usages