XF2 has a net charge of 0. F has 7 valence electrons, so when F forms an ionic bond, it gains 1 more electron to complete its octet, giving F a charge of -1. Two fluorines in one compound makes a charge of -2. To get a net charge of 0, X must have a charge of +2 in XF2. Elements that form a charge of +2 in ionic compounds include group 2 metals.