A discrete dislocation description in the framework of extended finite element method (X-FEM) (Gracie, Ventura, Belytschko, 2007) is applied to solve the two dimensional problem of an edge dislocation in an inhomogeneous material. The dislocation is represented as a discontinuity in a elastic body. The 8-node isoparametric quadrilateral element is used for numerical calculation and only the nodes in the vicinity of the discontinuous part are enriched by an enrich-function. A grain boundary is modelled as an elastic domain with different elastic moduli. The influence of grain boundary stiffness on stress field is studied.