I don't think this would be illegal if you put up a sign warning them of the danger. When they ignore the "Warning electric garbage can" sign, you can have satisfaction.
Otherwise if they really want to they can charge you.
We're not in the states or are law really this tight that someone can get charged for electrifying their own property? Neighbors of mine back in Jasper had an electric fence that lined their yard and I don't remember ever seeing a sign. Plus one of these electric fences isn't going to kill anyone, pain yes but definitely won't kill anyone, My in-laws have these setup all over the place on their farm up north and a few shocks later I'm still around.