Forum Xamarin.Forms

I need to show popup from the shell page?

Shell page was my root view and i added content page as a child to shell page , content page has child its popup and i am try to show popup in x,y point but my popup show in wrong position . its because of shell page title view height it not added with my popup y point can any one help me out to show popup in correct points.

Tagged:

Answers

  • NicolasKrierNicolasKrier FRMember ✭✭✭

    You can get the height of the screen which you substract the height of the popup and then divide by 2 the result and you get your Y position.

  • vickyYkcivvickyYkciv Member

    @NicolasKrier said:
    You can get the height of the screen which you substract the height of the popup and then divide by 2 the result and you get your Y position.

    let me clear something ,
    let assume screen size=800
    in IOS my status bar height=20
    and shell.Titleview height=40
    my button height =40
    my popup height=200
    popup width=300
    my popup expected y position is status bar height + titleview height +button height(100)
    actual y position is status bar+ button height(60)
    i dont getting the height of titleview??
    like you said 800-200/2 300

  • NicolasKrierNicolasKrier FRMember ✭✭✭
    edited March 19

    You said my button height =40
    Then you said button height(100)
    And finish by saying button height(60)

    Why does the height of your button changing that often ? :D

    Do you need a custom popup ? A native one ? A navigation ?

    A simple solution would be to have something like :

    <Grid>
        <MyWholeContent />
    
        <!-- Overlay to make the page content look like disabled -->
        <Grid BackgroundColor="Black" Opacity="0.5" IsVisible="{Binding IsVisible, Source={x:Reference MyPopup}"/>
    
        <Grid x:Name="MyPopup" VerticalOption="Center" IsVisible="False">
            <MyPopupContent />
        </Grid>
    </Grid>
    

    In my case, I use a NavigationPage which handle the nav bar height and such things so I never faced this situation.

Sign In or Register to comment.