Silverlight - brings a popup to the forefront

I have 4 pop-ups that are defined as follows:

        <Popup x:Name="MyPopup1" IsOpen="True" Margin="0,10,0,0" Grid.Row="0" >
            <Popup.Child>
                <Thumb x:Name="thumb1" DragDelta="Thumb_DragDelta" Width="0" Height="0" Template="{StaticResource thumbDisplay}" />
            </Popup.Child>
        </Popup>
        <Popup x:Name="MyPopup2" IsOpen="True" Margin="0,20,0,0" Grid.Row="0" >
            <Popup.Child>
                <Thumb x:Name="thumb2" DragDelta="Thumb_DragDelta" Width="0" Height="0" Template="{StaticResource thumbDisplay}" />
            </Popup.Child>
        </Popup>

The template for Thumb is just a user control. Since the popups are already open, I update the contained thumb to increase the size when I need to show them to the user.

The problem is that when the user clicks on the thumb to drag it, I would really like it to be able to bring it to the fore, so it is the most important control - just like regular pop-ups.

I implemented the leftMouseDown event (in the usercontrol Thumb template) and tried both of the following (second to see if NOTHING works)

        Canvas.SetZIndex(this, 9999);

        Canvas.SetZIndex(VisualTreeHelper.GetOpenPopups().ElementAt(1), 9999);

( Z-Index 0 - , , , , - ). .

, , , , , ContentPResenter

( Z) Silverlight/WPF

+3
1

, - , , , IsOpen. , , , , , .

    private void FlashPopup(Popup popup) {
        popup.IsOpen = false;
        popup.IsOpen = true;
    }
+2

Source: https://habr.com/ru/post/1774112/


All Articles