SetZIndex is defined on the Panel class, which Canvas derives from. The compiler is generating a warning saying you're using a static method on a sub-type. This isn't an actual problem, but it may lead to confusions when used in certain ways. As SetZIndex is void returning, that shouldn't be a problem.
But imagine the following:
var ftpRequest = (FtpWebRequest) HttpWebRequest.Create("ftp://my.ftp.com");
Create is actually a static method of WebRequest, but is used on HttpWebRequest instead, because it is a derived-type and you may do so. So, you'd expect it to be a web request which is being generated, right? But it isn't, it generates a FtpWebRequest, because that's specified in the URI.
Edit:
I want to point out that generally, the compiler warnings are there for a reason, that is way this one exists as well. As long as there is no overload of SetZIndex created in the Canvas class, the call is safe. But as @SriramSakthivel points out in the comments, if any extension method or static method is added to the Canvas class (using the new modifier) along the way, by you or by anyone else, it will no longer output the desired result and you must be aware of that.