UrhoSurface is always on top, can't show a popup over it

I have a ContentPage that uses an absolute layout. In that layout, I have a ContentView to show my content, and I overlay another ContentView for popups.

Generally, the popup ContentView is not visible. When I want to show a popup, I set the content, set Opacity to 0, set IsVisible to true, then fade it in.

Everything works perfectly.

Now I have a UrhoSurface in my main content, and my popup ContentView is rendered under the UrhoSurface, but above everything else (the Xamarin.Forms controls).

I'm using Xamarin.Forms and a WPF project where I get the UrhoSurface via a custom renderer that returns a Urho.Extensions.Wpf.UrhoSurface.

It seems that the UrhoSurface has an "always on top" attribute set.

The popups work perfectly fine for all other views, it's only when I have a UrhoSurface showing, that it is drawn under the surface.

Is there a setting in WPF or Xamarin.Forms where I can address the Z order?

Best Answer

  • CaseCase US ✭✭✭
    Accepted Answer

    @ClintStLaurent
    HA! Just had to bind the IsVisible property, hide the control, show my popup, then show it again.

Answers

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Xamarin doesn't expose the Z order. Its in the order the items are added to the Children collection.
    So... Instead of just hide/show the popup you'd have to remove it from the host container then add it back in to put it on top.

    Out of curiosity and nothing more... Did you try an existing popup framework like rg.plugins.popups before creating your own? Its treated us well and saved us a bunch of hours over re-inventing the wheel.

  • CaseCase USMember ✭✭✭

    @ClintStLaurent Oh yes, I love rg.plugins.popups, but I need to support a WPF application running on Windows 10 build 10240, and they don't support those platforms (or at least I couldn't get them to work)

    I'm afraid I'll have to destroy the urho surface to show the popup, then restart it.

    Unfortunately, UrhoSharp.Forms doesn't have renderers that work for Xamarin.Forms.WPF, so I need to do all the Urho work in the WPF project, and simply return a view control for Xamarin.Forms to render.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Ugh... What pain in the arse.
    Here... You need this.

  • CaseCase USMember ✭✭✭

    Thanks, I order it by the ton-load, daily.

    Their IT people refuse to upgrade past Windows 10 build 10240, and it has caused major headaches!

    Somehow I've gotten lots of packages to work in WPF via custom renderers. It's been a positive learning experience at least!

  • CaseCase USMember ✭✭✭
    Accepted Answer

    @ClintStLaurent
    HA! Just had to bind the IsVisible property, hide the control, show my popup, then show it again.

Sign In or Register to comment.