|
// MainPage.xaml
<ContentPage.BindingContext>
<local:ViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
<StackLayout>
<Button x:Name="isOpenButton" Text="Click to open popup" Command="{Binding OpenPopupCommand}"/>
</StackLayout>
</ContentPage.Content>
//ViewModel.cs
public class ViewModel
{
private SfPopupLayout popupLayout1;
private SfPopupLayout popupLayout2;
private DataTemplate templateView;
public ICommand OpenPopupCommand { get; set; }
public ViewModel()
{
OpenPopupCommand = new Command(OpenPopup);
popupLayout1 = new SfPopupLayout();
popupLayout1.PopupView.AnimationMode = AnimationMode.None;
popupLayout2 = new SfPopupLayout();
templateView = new DataTemplate(() =>
{
Button popupContent = new Button();
popupContent.Text = "Click to open another popup";
popupContent.Clicked += (s, e) =>
{
popupLayout1.Dismiss();
popupLayout2.Show();
};
return popupContent;
});
popupLayout1.PopupView.ContentTemplate = templateView;
}
private void OpenPopup()
{
popupLayout1.Show();
}
} |