That's a no-no. Break the Positive wire across the light switch and return the Negative wire to the negative side of the 12V source. Most modern dimmer switches don't work on 12V.
Let's Get It Fixed!
HomeX virtual experts will assess your issue (for free!) and can resolve simple problems.