Reputation: 28586
I have the following UserControl
<UserControl x:Class="MyControl">
<Canvas Background="Transparent">
<Line x:Name="line"/>
<TextBlock x:Name="textBlock" Panel.ZIndex="99999999" />
<Polygon Name="arrow" "/>
</Canvas>
</UserControl>
a) Is the Panel.ZIndex="99999999"
a correct way to set this control as the TopMost in that control?
b) Will it change if I switch the visibility (Visible=>Invisible=>Visible) ?
Upvotes: 3
Views: 4610
Reputation: 28586
an other option is just to change the order of elements in the node
<line/>
<arrow/>
<textBlock/>
Upvotes: 1
Reputation: 184506
a) That is quite unclean, i'd suggest you add the system namespace
xmlns:sys="clr-namespace:System;assembly=mscorlib"
And set it like this:
Panel.ZIndex="{x:Static sys:Int32.MaxValue}"
b) That should have no effect.
Upvotes: 3
Reputation: 34198
a) Yes, though setting it to 1
would usually be sufficient.
b) No.
Upvotes: 2