The alignment of particles in a confined shear flow of a viscoelastic fluid is quantitatively analyzed using an extended finite element method (XFEM) with a temporary arbitrary Lagrangian-Eulerian (ALE) scheme. The no-slip boundary condition on the particle surface is realized by using a newly proposed weak boundary condition, which is equivalent to adding a positive definite stabilizing term in the momentum balance. Once particles form a string-like structure, the final state is independent of the initial particle positions and the histories to reach the steady-state. For a certain fluid rheology, the maximum obtainable length of a string of particles is limited. As the Weissenberg number increases, particles can form longer strings. Moderate wall confinement promotes the alignment of particles, however, too strong confinement hinders the alignment by enhancing repulsive interaction between particles. The steady-state angular velocities of particles are compared with respect to the length of strings. If particles can form sufficiently long strings, the steady-state angular velocities of the two end-particles do not change significantly, and those of the non end-particles increase, as the string length increases. In a given string, the angular velocity of the two end-particles is faster than those of the particles in between. We have also presented the steady-state interparticle distance between two neighboring particles in a string. As the string length increases, the interparticle distance increases.