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
close icon

SfPopup with arrow and relative positioning using MVVM

I would like to show popups relative to the relevant UI controller. I.e. if one clicks on an Entry then I would like to show a popup. Similarly when eg. tapping a Label. In addition to this, I would like the popup to show an arrow (as seen on several IOS apps), pointing to the UI element that triggered the popup and therefore is relevant. If a popup has its "origin" from an Entry then often I would like that selected values in the popup should be reflected in the Entry when the popup is closed. That's why the arrow is an important element. All done in MVVM. I included an image in order to visualize what I had in mind. Could this be done using Sfpopup?

Attachment: popup_arrow_a.png_1fa539e3.zip

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team March 7, 2019 12:17 PM UTC

Hi Øystein, 
 
Thank you for contacting Syncfusion support. 
 
Based on the provided information, we have checked your requirement of “Handling Popup layout position based on the requirement” in Xamarin.Forms can be achieved using the ShowRelativeToView property of popupLayout. Using this property, you can position the popup layout based on the necessity whether in Right, Top and Bottom. 
 
We have prepared simple sample based on your requirement, please find the sample by the following link. 
 
Sample link: PopupRelativeSample 
 
In the sample, we have disabled both Header and Footer, and we maintained Content alone by setting the ContentTemplate. In the template, we have added button and label with the values. By setting position as Right in the ShowRelativeToView of Popup layout, positioned the layout in the Right.  
 
Please refer the following code example, 
 
[C#] 
private void ClickToShowPopup_Clicked(object sender, EventArgs e) 
        { 
            popupLayout.ShowRelativeToView(layout, RelativePosition.AlignToRightOf, 0, 0); 
       
 
 
We hope this helps. Please let us know, if you have any query. 
 
Regards,
Subburaj Pandian V  


Loader.
Live Chat Icon For mobile
Up arrow icon