Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
148807 | Nov 5,2019 11:53 AM UTC | Nov 7,2019 11:30 AM UTC | Xamarin.Forms | 4 |
![]() |
Tags: SfPopup |
[PopupPage.Xaml.cs]
private async void Button_Clicked(object sender, EventArgs e)
{
await this.DisplaySfPopupAlert("PopupHeader","Popup", null , "Cancel");
}
private async void Button_Clicked_1(object sender, EventArgs e)
{
await this.DisplaySfPopupAlert("PopupHeader", "Popup", "Ok", "Cancel");
}
public async Task<bool> DisplaySfPopupAlert(string title, string message, string acceptText, string cancelText)
{
........
popupLayout.PopupView.AppearanceMode = string.IsNullOrEmpty(acceptText) ? AppearanceMode.OneButton : AppearanceMode.TwoButton;
if (popupLayout.PopupView.AppearanceMode == AppearanceMode.OneButton)
{
DataTemplate declineButtonTemplate = new DataTemplate(() =>
{
StackLayout _stackLayout = new StackLayout();
Button declineButton = new Button();
declineButton.Text = cancelText;
declineButton.BackgroundColor = Color.White;
declineButton.TextColor = Color.Black;
declineButton.HorizontalOptions = LayoutOptions.End;
declineButton.Command = new Command(() => {
PopupAccepted = false;
popupLayout.IsOpen = false;
});
_stackLayout.Children.Add(declineButton);
return _stackLayout;
});
popupLayout.PopupView.FooterTemplate = declineButtonTemplate;
}
else
{
..........
}
.........
} |
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.
This page will automatically be redirected to the sign-in page in 10 seconds.