  We investigate the role of the electromagnetic interaction in the formation
and decay of the $X(3872)$. The binding properties of the $X(3872)$ are studied
by assuming the molecular nature and considering the $S$-$D$ wave mixing,
isospin breaking, and coupled channel effects, and in particular the correction
from the electromagnetic interaction. The radiative decays can better reflect
the difference between the charged and neutral $D\bar D^*$ components, since
the electromagnetic interaction explicitly breaks the isospin symmetry. We
further study the radiative decay widths with the obtained wave functions for
different $D\bar D^*$ channels. We also explore other similar hidden-charm
molecular states. The electromagnetic interaction can make the molecule
tighter. Our result of the radiative decay width for $X(3872)\rightarrow \gamma
J/\psi$ is in agreement with the experiment. The branching ratio
$R_{\gamma\psi}$ is less than 1 in our framework, which supports the Belle and
BESIII measurements.
