|
<ContentPage.BindingContext>
<local:PopupViewModel x:Name="viewModel"></local:PopupViewModel>
</ContentPage.BindingContext> …..
<sfPopup:PopupView.ContentTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Entry Grid.Row="0" Text="{Binding UserName}"></Entry>
<Button Grid.Row="1" x:Name="loginButton" Text="click" Command="{Binding PopupAcceptCommand}"></Button>
</Grid>
</DataTemplate>
</sfPopup:PopupView.ContentTemplate> ….
class PopupViewModel : INotifyPropertyChanged
{
bool isOpen, visible;
string labelString, userName, password, showdetail;
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public ICommand PopupAcceptCommand { get; set; }
public string UserName
{
get { return userName; }
set
{
userName = value;
OnPropertyChanged(nameof(UserName));
}
}
public PopupViewModel()
{
PopupAcceptCommand = new Command(PopupAccept);
}
private void PopupAccept()
{
var a = UserName;
}
} |