<ContentPage.Content>
<sfPopup:SfPopupLayout x:Name="popupLayout">
<sfPopup:SfPopupLayout.PopupView>
<sfPopup:PopupView AppearanceMode="TwoButton"
AcceptButtonText="Save"
DeclineButtonText="Cancel">
<sfPopup:PopupView.ContentTemplate>
<DataTemplate>
<StackLayout x:Name="mainStack">
<Label Text="You have not provided your name yet."
HorizontalTextAlignment="Center"/>
<Entry x:Name="entry"
Placeholder="Enter name"
Text="{Binding EntryString,Source={x:Reference viewModel}}"/>
</StackLayout>
</DataTemplate>
</sfPopup:PopupView.ContentTemplate>
</sfPopup:PopupView>
</sfPopup:SfPopupLayout.PopupView>
<sfPopup:SfPopupLayout.Content>
<StackLayout>
<Button Clicked="Button_Clicked" Text="Open"/>
</StackLayout>
</sfPopup:SfPopupLayout.Content>
</sfPopup:SfPopupLayout>
</ContentPage.Content>
|
…
popupLayout.PopupView.AcceptCommand = new AcceptButtonCustomCommand();
…
public class AcceptButtonCustomCommand : ICommand
{
private Entry entry;
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
var stack = (parameter asSfPopupLayout).PopupView.ContentTemplate.CreateContent();
entry = (stack as StackLayout).FindByName<Entry>("entry");
var text = entry.Text;
}
}
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"xmlns:SyncfusionBorder="clr-namespace:Syncfusion.XForms.Border;assembly=Syncfusion.Core.XForms"xmlns:SyncfusionPopup="clr-namespace:Syncfusion.XForms.PopupLayout;assembly=Syncfusion.SfPopupLayout.XForms"xmlns:SyncfusionImageEditor="clr-namespace:Syncfusion.SfImageEditor.XForms;assembly=Syncfusion.SfImageEditor.XForms"x:Class="MyApp.MyProfile">