We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SFPopupLayout produces NullReference on IsOpen = true after navigation (xamarin forms)

Thread ID:





140972 Nov 16,2018 12:54 PM UTC Nov 26,2018 12:59 PM UTC Xamarin.Forms 3
Tags: SfPopup
Ben Reierson
Asked On November 16, 2018 12:57 PM UTC

I'm using an SfPopup defined in xaml and binding to the IsOpen property. This is on a navigation page that contains a grid with two rows, the second of which is height *. Here is the popup definition:

 <sfPopup:SfPopupLayout Grid.Row="1" x:Name="InfoPopup" 
                           IsOpen="{Binding IsInfoOpen, Mode=TwoWay}" />

On first navigating to this page, there is no issue, and the popup can be opened/closed multiple times. After navigating back, then forward again to the same page, the popup produces a NullReference exception when IsOpen changes to true. All other controls on the page work fine, including an SfDataGrid. I tried removing the binding to IsOpen and using .Show(), but that produced the same issue. This is with version on iOS 12, xamarin forms version Have also tested with rowspan = 2. 

"  at Syncfusion.XForms.iOS.PopupLayout.SfPopupLayout.ResizePopupView () [0x001e4] in <1356613810c24590a725cab6be10944b>:0 \n  at Syncfusion.XForms.iOS.PopupLayout.SfPopupLayout.DisplayPopup () [0x00026] in <1356613810c24590a725cab6be10944b>:0 \n  at Syncfusion.XForms.iOS.PopupLayout.SfPopupLayout.set_IsOpen (System.Boolean value) [0x00024] in <1356613810c24590a725cab6be10944b>:0 \n  at Syncfusion.XForms.iOS.PopupLayout.RendererHelper.MapSfPopupLayoutProperties (System.String propertyName, Syncfusion.XForms.PopupLayout.SfPopupLayout formsPopupLayout, Syncfusion.XForms.iOS.PopupLayout.SfPopupLayout nativePopupLayout) [0x0003c] in <1356613810c24590a725cab6be10944b>:0 \n  at Syncfusion.XForms.iOS.PopupLayout.PopupLayoutDependencyService.MapSfPopupLayoutProperties (System.String propertyName, Syncfusion.XForms.PopupLayout.SfPopupLayout formsPopup) [0x00010] in <1356613810c24590a725cab6be10944b>:0 \n  at Syncfusion.XForms.PopupLayout.SfPopupLayout.OnIsOpenChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00042] in <6491071ab4dc4290b46b78b9473c7fd0>:0 \n  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\\a\\1\\s\\Xamarin.Forms.Core\\BindableObject.cs:625 \n  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\\a\\1\\s\\Xamarin.Forms.Core\\BindableObject.cs:417 \n  at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x00225] in D:\\a\\1\\s\\Xamarin.Forms.Core\\BindingExpression.cs:173 \n  at Xamarin.Forms.BindingExpression.Apply (System.Boolean fromTarget) [0x0003e] in D:\\a\\1\\s\\Xamarin.Forms.Core\\BindingExpression.cs:57 \n  at Xamarin.Forms.BindingExpression+BindingExpressionPart.b__49_0 () [0x00000] in D:\\a\\1\\s\\Xamarin.Forms.Core\\BindingExpression.cs:615 \n  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/ "

Vigneshkumar Ramasamy [Syncfusion]
Replied On November 20, 2018 10:20 AM UTC

Hi Ben,  
Thanks for contacting Syncfusion Support.   
We checked your query and the shared code. From the code snippet, we are able to get that you are using SfPopupLayout in a wrong use case.   
SfPopupLayout can only be the root of the page, but in your code snippet, you have added it as the child of the Grid, which is a wrong use case.  
SfPopupLayout can be used in two ways,   
Displaying pop-up when the SfPopupLayout is set as root view : Popup can be displayed when it is set as the root view of the page. Please refer the below UG link for more details on how to show popup when popup is the root view. 
Displaying pop-up when the SfPopupLayout is not set as root view : Popup can be displayed by calling it on the fly, please refer the below UG link for more details on how to show popup on the fly. 
We prepared the sample as per your requirement to display popup in the navigation page, where SfPopupLayout.IsOpen is binded to the property in the ViewModel. Please find the code snippet of the same below.  
    <local:ViewModel />  
<sfpopup:SfPopupLayout x:Name="popup" IsOpen="{Binding DisplayPopup}">  
                <RowDefinition />  
                <RowDefinition Height="*"/>  
            <Button Grid.Row="0" Text="Click to open popup" Command="{BindingOpenPopupCommand}"/>  
You can download the sample from the below link.  
Vigneshkumar R 

Ben Reierson
Replied On November 20, 2018 10:31 AM UTC

Ok, thanks for the help. To be honest, I don't understand why it would have this restriction. My feedback/request is to consider enhancing SfPopupLayout to allow for both methods of showing it, regardless of whether it's the rootview. 

Vigneshkumar Ramasamy [Syncfusion]
Replied On November 26, 2018 12:59 PM UTC

Hi Ben,  
We have analyzed your query “Popup has not displayed while popup is set as content of Grid”, Due to some restrictions we were unable to display the popup at desired position as per your requirement, Hence we have logged the bug report for the same, The issue will be fixed our any one of the upcoming release. Also we have provide the work around sample in the following link.  
Disclaimer : The date for the issue fix is tentative and not a commitment on our parts.  
Vigneshkumar R 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon