|
//MainPage.xaml
<ContentPage.Content>
<sfPopup:SfPopupLayout x:Name="popupLayout">
<sfPopup:SfPopupLayout.PopupView>
<sfPopup:PopupView ShowHeader="False" ShowFooter="False" HeightRequest="100"WidthRequest="100">
<sfPopup:PopupView.ContentTemplate>
<DataTemplate>
<!-- Content to be displayed in popup -->
<Label Text="Tool tip" BackgroundColor="White"TextColor="Black"/>
</DataTemplate>
</sfPopup:PopupView.ContentTemplate>
</sfPopup:PopupView>
</sfPopup:SfPopupLayout.PopupView>
<sfPopup:SfPopupLayout.Content>
<!--View on which the popup should be displayed-->
<StackLayout>
<Button x:Name="showPopupButton" Text="Click to show popup" />
</StackLayout>
</sfPopup:SfPopupLayout.Content>
</sfPopup:SfPopupLayout>
</ContentPage.Content>
// MainPage.xaml.cs
showPopupButton.Clicked += ShowPopupButton_Clicked;
private void ShowPopupButton_Clicked(object sender, EventArgs e)
{
// Displays popup to the bottom of the button.
popupLayout.ShowRelativeToView(sender as View, RelativePosition.AlignBottom);
// Displays popup at touch point
//popupLayout.ShowAtTouchPoint();
// Displays popup at given x and y position
//popupLayout.Show(50, 50);
} |