//private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) //{ // if (e.PropertyName == "ErrorMessage" // && !string.IsNullOrEmpty(viewModel.ErrorMessage)) // { // DisplayAlert("Error", viewModel.ErrorMessage, "OK"); // } //} public FilePreviewPage(FilePreviewViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; ShowPreviewButton.Clicked += ShowPreviewButton_Clicked; }
public FilePreviewPage() { InitializeComponent(); var item = new Item { Text = "Item 1", Description = "This is an item description." }; viewModel = new FilePreviewViewModel(item); viewModel.Setup(this);// PropertyChanged += ViewModel_PropertyChanged; BindingContext = viewModel; }