I have investigated a bit more and the behaviour is still a bit odd.
I noticed that if load the data and call Map.ZoomToExtents. Then the extents are set how I would expect.
So I changed the code to this:
var env = Map.GetExtents();
Map.MaximumExtents = Map.GetExtents();
Map.EnforceMaximumExtents = true;
And it still fits the map to largest dimension, rather than the smallest.
I went off the idea of calculating the ratio of height to width as this would have to be calculated on every resize.
My use case is that I'm displaying a png image (a schematic map with other polygons etc drawn over the top) and I need an option to lock the extent so it can't be zoomed in on. So I really need the whole image displayed no matter the shape of the window. As
it is it only fits it to the largest dimension