Electronic influences on the crystal chemistry of transition metal-main group MX and MX2 compounds