Declined
Last Updated: 11 Feb 2019 11:02 by ADMIN
Marc
Created on: 05 Feb 2019 17:41
Category: Popup
Type: Feature Request
5
Add option to center a Popup on the page

Please add an option to center the Xamarin Popup on the page, both horizontally and vertically.   The popup should not move when pickers (and other similar controls) are opened/closed.

Thank you

8 comments
ADMIN
Yana
Posted on: 11 Feb 2019 11:02
Hi Marc,

Thank you for the snippet - I was able to reproduce the erroneous behavior on iOS and I have logged it separately on your behalf. You could track its status at the link below:
https://feedback.telerik.com/xamarin/1387284-popup-ios-the-popup-is-misplaced-when-a-picker-items-are-displayed

I have updated your Telerik points for bringing this to our attention.

I have also changed the status of this item to "Declined" as RadPopup currently provides a way to be positioned centrally - attach it to the Page element and send its Placement property to Center.

Let me know in case any additional questions arise.

Regards,
Yana
Progress Telerik
Marc
Posted on: 08 Feb 2019 20:12

Thanks for the sample code Yana!   It works perfectly in Android.

I was able to reproduce the iOS picker issue in your sample project by changing MainPage.xaml as follows.   Note that after you choose a County, the popup goes higher on the page.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:PopupTest"
            xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
             xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
             x:Name="currentPage"
             x:Class="PopupTest.MainPage">
    <telerikPrimitives:RadPopup.Popup>
        <telerikPrimitives:RadPopup x:Name="popNewUserRegistration" IsModal="True" OutsideBackgroundColor="#99000000" AnimationType="Zoom" Placement="Center">
            <Frame x:Name="frameNewUserRegistration" HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="White" Margin="10" Padding="10" MinimumWidthRequest="300" WidthRequest="300">
                <StackLayout Orientation="Vertical">
                    <Label Text="New User Registration" FontAttributes="Bold" FontSize="18" HorizontalOptions="Center" Margin="10,20,10,20"/>
                    <Label Text="Company" TextColor="#20435C" FontSize="14" FontAttributes="Bold" Margin="10,20,10,0"/>
                    <Entry x:Name="eCompany" Placeholder="Required" MaxLength="50" Margin="10,0,10,0"/>
                    <Label Text="Phone Number" TextColor="#20435C" FontSize="14" FontAttributes="Bold" Margin="10,0,10,0"/>
                    <Entry x:Name="ePhoneNumber" Placeholder="Required" Keyboard="Numeric" MaxLength="50" Margin="10,0,10,0"/>
                    <Label Text="County" TextColor="#20435C" FontSize="14" FontAttributes="Bold" Margin="10,0,10,0"/>
                    <Picker x:Name="pkrCounty" Title="Select a County" Grid.Row="2" Margin="10,0,10,0"/>
                    <Label x:Name="lblAccountManager" Text="Account Manager" TextColor="#20435C" FontSize="14" FontAttributes="Bold" Margin="10,0,10,0"/>
                    <Picker x:Name="pkrAccountManager" Title="Select an Account Manager" Margin="10,0,10,0"/>
                    <ActivityIndicator x:Name="aiWaitRegistration" IsRunning="true" IsVisible="false" Margin="10,10,10,10" HorizontalOptions="Center"/>
                    <telerikInput:RadButton x:Name="btnSubmit" Text="Submit" Margin="10,20,10,20"/>
                </StackLayout>
            </Frame>
        </telerikPrimitives:RadPopup>
    </telerikPrimitives:RadPopup.Popup>
    <ContentPage.Content>

        <AbsoluteLayout>
                <StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">

                <StackLayout Orientation="Vertical">
                
                </StackLayout>
                <Label Grid.Row="1" Text="Page outside" />
                <Button Grid.Row="2" Text="test" Clicked="Button_Clicked" />
            </StackLayout>
        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>

 

Thanks, Marc

ADMIN
Yana
Posted on: 08 Feb 2019 15:01
Hi Marc,

The proper way to center the popup when it is declared in XAML is to attach it to the Page element and set its Placement property to "Center" like this:

    ....
    x:Class="PopupTest.MainPage">
    <telerikPrimitives:RadPopup.Popup>
        <telerikPrimitives:RadPopup x:Name="popNewUserRegistration"                                  
                                    IsModal="True"
                                    Placement="Center"
                                    OutsideBackgroundColor="Red">
            <telerikPrimitives:RadBorder CornerRadius="8" BackgroundColor="Wheat">
                ...
            </telerikPrimitives:RadBorder>
        </telerikPrimitives:RadPopup>
    </telerikPrimitives:RadPopup.Popup>
    <ContentPage.Content>
        <AbsoluteLayout>
        ....
        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>

You don't need to set VerticalOffset in this situation. I have attached the updated project, could you download it and test it? Please let me know the result on your side.

In addition, if you could isolate the issue with the popup misplacement when a picker is shown on iOS in a sample app, please send it to us, so we could further investigate it.

I am looking forward to your reply.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Attached Files:
Marc
Posted on: 07 Feb 2019 16:56

Hi Yana,

Below are the results of my testing in your project.   The iOS popup appears perfectly centered, but the Android popup appears to be centered between the parent control (the Test label) and the bottom of the screen.

 

 

Here's the hierarchy of my popup control... I don't really want to associate it with another control... just the page itself, and I will open/close the popup using the IsOpen property.   Is that not possible?

<ContentPage.Content>

        <AbsoluteLayout>

            <Image x:Name="splashScreen" Style="{DynamicResource SplashScreen}" Aspect="AspectFill" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All"/>

            <StackLayout AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">

                <StackLayout Orientation="Vertical">

                    <telerikPrimitives:RadPopup.Popup>

                        <telerikPrimitives:RadPopup x:Name="popNewUserRegistration" IsModal="True" OutsideBackgroundColor="#99000000" AnimationType="Zoom" PlacementTarget="this" Placement="Center">

 

Thanks

ADMIN
Yana
Posted on: 07 Feb 2019 16:06
Hi Marc,

When the popup is defined in XAML it should always be attached to an element (using RadPopup.Popup attached property) and this element is considered as its PlacementTarget (even if you set it explicitly to the Popup control).  I guess that's the reason the popup is displayed  at the top of the page on your side.  Still, to be sure I'd need to check the complete XAML you have on the page.

I have also tried to reproduce the issue with setting VerticalOffset and opening a Picker control on iOS, however, without much success.  I have attached my test app, could you download it and give it a try?  Can you modify it, so that the issue to be reproduced and send it back to me?

I am looking forward to your reply.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Attached Files:
Marc
Posted on: 06 Feb 2019 14:39

Hi Yana,

Here's my xaml, where "this" is the name of the ContentPage:

<telerikPrimitives:RadPopup x:Name="popNewUserRegistration" IsModal="True" OutsideBackgroundColor="#99000000" AnimationType="Zoom" PlacementTarget="this" Placement="Center">

In iOS, the popup is at the top of the page, and too far to the left.   When we used VerticalOffset to force the popup to the center vertically, opening a picker caused the popup to shift up towards the top of the page.

In Android, the popup is centered horizontally, but at the top of the page.

Thanks,

Marc

ADMIN
Yana
Posted on: 06 Feb 2019 09:43
Hello guys,

In general, when popup is attached to the page and its Placement is set to "Center", its position is centered horizontally and vertically. 

Marc, since you've mentioned the popup moves in certain situations, could you elaborate more on this scenario? I've tested placing Picker and RadAutoCompleteView inside the popup and didn't manage to reproduce the described behavior.

I am looking forward to your reply.

Regards,
Yana
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Ronald
Posted on: 05 Feb 2019 21:24
+1 This would be very much appreciated.