Probing and controlling the valley degree of freedom in graphene systems by transport measurements has been a major challenge to fully exploit the unique properties of this two-dimensional material. In this theoretical work, we show that this goal can be achieved by a quantum-wire geometry made of gapped graphene that acts as a valley filter with the following favorable features: i) all electrical gate control, ii) electrically switchable valley polarity, iii) robustness against configuration fluctuation, and iv) potential for room temperature operation. This valley filtering is accomplished by a combination of gap opening in either bilayer graphene with a vertical electrical field or single layer graphene on h-BN, valley splitting with a horizontal electric field, and intervalley mixing by defect scattering. In addition to functioning as a building block for valleytronics, the proposed configuration makes it possible to convert signals between electrical and valleytronic forms, thus allowing for the integration of electronic and valleytronic components for the realization of electro-valleytronics.