We investigate the formation and evolution of dwarf galaxies in a high resolution , hydrodynamical cosmological simulation of a Milky Way sized halo and its environment . Our simulation includes gas cooling , star formation , supernova feedback , metal enrichment and UV heating . In total , 90 satellites and more than 400 isolated dwarf galaxies are formed in the simulation , allowing a systematic study of the internal and environmental processes that determine their evolution . We find that 95 \% of satellite galaxies are gas-free at z = 0 , and identify three mechanisms for gas loss : supernova feedback , tidal stripping , and photo-evaporation due to re-ionization . Gas-rich satellite galaxies are only found with total masses above \sim 5 \times 10 ^ { 9 } \mathrm { M } _ { \odot } . In contrast , for isolated dwarf galaxies , a total mass of \sim 10 ^ { 9 } \mathrm { M } _ { \odot } constitutes a sharp transition ; less massive galaxies are predominantly gas-free at z = 0 , more massive , isolated dwarf galaxies are often able to retain their gas . In general , we find that the total mass of a dwarf galaxy is the main factor which determines its star formation , metal enrichment , and its gas content , but that stripping may explain the observed difference in gas content between field dwarf galaxies and satellites with total masses close to 10 ^ { 9 } \mathrm { M } _ { \odot } . We also find that a morphological transformation via tidal stripping of infalling , luminous dwarf galaxies whose dark matter is less concentrated than their stars , can not explain the high total mass-light ratios of the faint dwarf spheroidal galaxies .