In the investigation and resolution of the cosmological constant problem the inclusion of the dynamics of quantum gravity can be a crucial step. In this work we suggest that the quantum constraints in a canonical theory of gravity can provide a way of addressing the issue: we consider the case of two-dimensional quantum dilaton gravity non-minimally coupled to a U(1) gauge field, in the presence of an arbitrary number of massless scalar matter fields, intended also as an effective description of highly symmetrical higher-dimensional models. We are able to quantize the system non-perturbatively and obtain an expression for the cosmological constant Lambda in terms of the quantum physical states, in a generalization of the usual QFT approach. We discuss the role of the classical and quantum gravitational contributions to Lambda and present a partial spectrum of values for it.