Yanıt UserControl ZIndex not working

  • 17 Ağustos 2011 Çarşamba 23:44
     
     

    Hello,

    I have a very simple user control with a grid and in the grid is one image. When the main page loads I load the user control but it is hidden. Then based upon user interaction I change the visibility to visible but it isn't showing. Well this is because it is layered under other elements. For example as a lame work around I can set the other elements visibility to hidden in the event handler and my control will show up. I have tried setting the Panel.ZIndex="99999" but that is not bringing it to the top?? Am I using the wrong property?

     

    Any ideas greatly appreciated

    JB

Tüm Yanıtlar

  • 18 Ağustos 2011 Perşembe 15:34
    Moderatör
     
     

    Hi zzpluralza,

    Not wrong, but it is unnecessary to set this value so large, and please try to set the other elementrs to a small value. And please be sure the other elements and your UserControl are in one same panel, since only the controls in the same panel can be changed the layer by setting the Panel.ZIndex property.

    I am not sure what is "the other elements", is it a WPF control?

    Could you please provide the code, I cannot guess the cause?

     

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


  • 18 Ağustos 2011 Perşembe 15:45
    Moderatör
     
     

    Please check my reply on your other thread about the New Window in WebBrowser: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7a6b7e31-0032-4917-b645-93fea37a93c5

    It can answer your question, and the solution is "Do not try to put the WPF control over the Winform or Win32, and the WPF WebBrowser and MediaElement also (since both just wrap the ActiveX/COM components, not a really WPF control)"

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • 18 Ağustos 2011 Perşembe 16:28
     
      Kod İçerir

    Ahh yes gotta love IE9. Every time I try to post code snippets in IE9 it bombs. So here is the code snippets posted by Safari.

    <Grid>
        <DrkBsyModal:DarkBusyModal x:Name="BusyBee" Panel.ZIndex="999999" />
        <WebBrowser Height="768" HorizontalAlignment="Left" Name="MVWebrowser" VerticalAlignment="Top" Width="1024" Initialized="MVWebrowser_Initialized" Navigating="MVWebrowser_Navigating" Navigated="MVWebrowser_Navigated" />
      </Grid>
    

    It is there just hidden behind webbrowser. If I set browser to hidden in event handler it shows.

  • 18 Ağustos 2011 Perşembe 17:38
    Moderatör
     
     Yanıt
    Yes, seems it is the only workaround we can do now. The "AirSpace" issue is WPF limitation, I heared WPF 5 may have solution to change, but I do not get the confirmation.
    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Yanıt Olarak İşaretleyen zzpluralza 18 Ağustos 2011 Perşembe 20:03
    •  
  • 18 Ağustos 2011 Perşembe 20:04
     
     

    Read this article on it here:

    http://msdn.microsoft.com/en-us/library/aa970688(v=vs.85).aspx

    Makes sense...so till WPF5 or beyond looks like I'll just turn visibility on and off.

     

    THX

    • Yanıt Olarak Öneren Pals28 10 Ağustos 2012 Cuma 12:39
    • Yanıt Önerisini Geri Alan Pals28 10 Ağustos 2012 Cuma 12:39
    •  
  • 10 Ağustos 2012 Cuma 12:41
     
     Önerilen Yanıt

    Try going for negative Panel.ZIndex. For example make the your usercontrol's Panel.ZIndex = -1 and for rest go for lower values like -2 or anything more negative.

    HTH


    Cheers

    • Yanıt Olarak Öneren Pals28 28 Kasım 2012 Çarşamba 03:31
    •