Canvas.GetZindex(...) is found in Silverlight but not in "standard" .NET4, so I'm guessing it's what you work with - you could have mentioned it, though.
WPF/Silverlight UI's are made of a bunch of different elements alongside or on top of each other (which in turn might have their own child elements), so I'm guessing that the z-indices are probably relative to the parent element.
What values are you getting, and what values you expected?
The GetZIndex(UIElement) method of the canvas class accepts a UIElement (as u can see) and returns its [element's] z-index, so I presume that by using this method you can get the z-index of the given element even if it's own class doesn't expose it, but I'm not sure. You'll have to experiment a bit.
If I'm right, then you just need to determine the right top level element.
"The z-order of an object determines whether the object is in front of or behind another overlapping object. By default, the z-order of objects within a Panel is determined by the sequence in which they are declared. Objects that are declared later appear in front of objects that are declared earlier. You can change this behavior by setting the Canvas.ZIndex attached property on objects within the Panel. Higher values are closer to the foreground; lower values are farther from the foreground.
This property is an example of an attached property syntax, whereby non-Canvas objects can set this property that can then be read and interpreted by a parent Canvas. For more information about attached properties, see Attached Properties Overview.
The value of the Canvas.ZIndex property is expressed as any numeric value. Although you can specify the value as a Double in markup, internally the value is converted to and treated as an integer.
You can also set the Canvas.ZIndex value to a negative value, such as "-99", which places the object even farther from the foreground. Canvas.ZIndex values are aligned along the z-axis -- higher values are closer to the foreground; lower values are farther from the foreground. The following illustration shows the relationship of z-order to z-axis."
Relationship of z-order to z-axis:
Make sure to check out the examples there (scroll down), these will show you how the method and the property are meant to be used, and help clarify things further.