  This paper studies affine Deligne-Lusztig varieties $X_{\tw}(b)$ in the
affine flag variety of a quasi-split tamely ramified group. We describe the
geometric structure of $X_{\tw}(b)$ for a minimal length element $\tw$ in the
conjugacy class of an extended affine Weyl group, generalizing one of the main
results in \cite{HL} to the affine case. We then provide a reduction method
that relates the structure of $X_{\tw}(b)$ for arbitrary elements $\tw$ in the
extended affine Weyl group to those associated with minimal length elements.
Based on this reduction, we establish a connection between the dimension of
affine Deligne-Lusztig varieties and the degree of the class polynomial of
affine Hecke algebras. As a consequence, we prove a conjecture of G\"ortz,
Haines, Kottwitz and Reuman in \cite{GHKR}.
