Watching the procession of King Charles III and family behind the coffin of Queen Elizabeth II, I would like to know what determines the military uniform they Royal Family members wear? Many of them are "commissioned" (or appointed) in all of the Armed Forces, often as "Colonel-in-Chief" or similar. King Charles III is obviously primarily a Royal Navy officer, having actually served, but what about the Princess Royal for example?
What determines which military uniform is worn at which event by members of the Royal Family
The question needs to be answered separately for each of them, owing to variations in their circumstances. In the UK, these matters are largely done by tradition and individuals' sense of what's appropriate. There are a lot less written rules than in many countries, especially the USA.
King Charles III
As monarch, and commander-in-chief, he's entitled to wear any uniform he likes. In June 2012, the late Queen appointed him to the honorary ranks of Admiral of the Fleet, Field Marshal, and Marshal of the RAF, the highest ranks in those services. In the procession in Edinburgh, he was wearing Field Marshal full-dress uniform. It's not obvious why he chose that: it could have been because the pall-bearers were from the Royal Regiment of Scotland.
In the procession from Buckingham Palace to Westminster Hall, he's wearing his Marshall of the RAF uniform. At the vigil of the Queen's children in Westminster Hall, he wore Royal Navy ceremonial dress.
Anne, Princess Royal
Anne has never served in the military. The posts of Colonel-in-chief, Commandant-in-chief and the like essentially amount to "Patron" - an important figure who is associated with the corps or unit. She holds the honorary ranks of Admiral, General, and Air Chief Marshal, one step below the top of the three services. She could wear whichever of those uniforms she wanted; in the procession in Edinburgh, she was in her Admiral's full-dress uniform, likely to provide representation for the Navy. She was in the same uniform for the procession from Buckingham Palace to Westminster Hall. At the vigil of the Queen's children in Westminster Hall, she wore full dress uniform of the Blues and Royals regiment, to which she is Colonel of the Regiment.
Andrew, Duke of York
Andrew has by far the most military service, having been an active naval officer from 1979 to 2001. I spoke in about 1996 to someone who worked with him at the Ministry of Defence (we were both on the same commercial training course) and apparently he was a perfectly reasonable officer, although not a brilliant one.
However, he is now in disgrace. His implausible claims in the matter of Virginia Giuffre v. Prince Andrew followed by his settlement of the case rather than testify under oath have been universally taken as "Yes, he did that, and he was dishonest about it." That's a catastrophic failure to behave properly as a royal, and there is no obvious way back for him. He does not seem to have committed a crime under UK law, since the age of consent here is 16, but he has behaved very badly, when in a position that requires him to behave well.
He returned all his military patronages and so on to the queen last year, and is no longer seen on conventional royal duties. The Navy probably doesn't want him to be seen in their uniform, which is why he's in civilian dress in the recent pictures. At the vigil of the Queen's children in Westminster Hall, he wore Royal Navy ceremonial dress, by special request of the King.
Edward, Earl of Wessex
Edward joined the Royal Marines as an officer cadet, but quit during initial training. He's always seemed a bit wet, and trying to prove he wasn't by undertaking the toughest initial training course in the UK military was not a clever move.
He does not have any honorary military rank, but his military patronages include being Colonel-in-Chief of the Royal Wessex Yeomanry, an army regiment whose name relates to his earldom. He was wearing a Colonel's uniform for that regiment, for the processions in Edinburgh and London, and at the vigil of the Queen's children in Westminster Hall.
William, Prince of Wales
He appeared in the procession from Buckingham Palace to Westminster Hall, in RAF Squadron Leader uniform. He was promoted to that rank in 2016, three years after leaving RAF service, so it's honorary, though not not nearly so much so as the ranks of the previous generation.
At the vigil of the Queen's grandchildren in Westminster Hall, he wore the uniform of the Blues and Royals regiment, in which he served.
As a non-working royal, he wore civilian dress in the procession from Buckingham Palace to Westminster Hall. He wore the uniform of the Blues and Royals regiment, in which he also served, at the request of the King, for the vigil of the Queen's grandchildren in Westminster Hall.
The queen's other six grandchildren have not served in the military, and wore civilian dress.
All of them were wearing medals, if they have them, but the medals they have are largely from the late Queen's various jubilees, royal orders and various commemorations. Charles and Anne have the Naval Long Service and Good Conduct medal, which is mostly honorary in their case. Andrew has the South Atlantic Medal, the campaign medal for service in the Falklands War, and a Naval Long Service and Good Conduct medal earned in service, although wearing the latter would be poor form now, I think. Harry has the Operational Service Medal for Afghanistan.