WPF TopMost control
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 cont开发者_如何学Gorol as the TopMost in that control?
b) Will it change if I switch the visibility (Visible=>Invisible=>Visible) ?
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.
a) Yes, though setting it to 1
would usually be sufficient.
b) No.
an other option is just to change the order of elements in the node
<line/>
<arrow/>
<textBlock/>
精彩评论