private void maininput_PreviewKeyDown(object sender, KeyEventArgs e) { try { if (e.Key == Key.Escape) { if (string.IsNullOrEmpty(maininput.Text)) { if (CancelCommand != null) { CancelCommand.Execute(null); } } else { SearchText = ""; e.Handled = true; } } if (e.Key == Key.Enter) { if (AcceptCommand != null) { AcceptCommand.Execute(maininput.Text); } } } catch (Exception ex) { logger.Error(ex); } }
public string this[string columnName] { get { Error = (columnName == "Token") && String.IsNullOrWhiteSpace(Token) ? Resources.ValidateMsgToken : String.Empty; AcceptCommand.RaiseCanExecuteChanged(); return(Error); } }
private void OKButton_Clicked(object sender, EventArgs e) { IsVisible = false; if (AcceptCommand != null) { if (AcceptCommand.CanExecute(null)) { AcceptCommand.Execute(Text); } } }
private void MetroWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && AcceptCommand.CanExecute(null)) { AcceptCommand.Execute(null); } else if (e.Key == Key.Escape) { Close(); } }
private async void AcceptPopupEvent(object sender, EventArgs e) { await DeviceExtension.BeginInvokeOnMainThreadAsync(async() => { await Navigation.PopPopupAsync(); }); // waiting for close animation finished await Task.Delay(300); AcceptCommand?.Execute(AcceptCommandParameter); //_popupId++; IsClosed = true; }
private void ValueTextBox_OnTextChanged(object sender, TextChangedEventArgs e) { watermark.Visibility = !IsReadOnly && string.IsNullOrEmpty(Value) ? Visibility.Visible : Visibility.Collapsed; AcceptCommand.RaiseCanExecuteChanged(); CanAccept = CanExecuteAcceptMethod(null); }
protected void CanAcceptChanged() => AcceptCommand.OnCanExecuteChanged();
private void AcceptCommand_CanExecuteChanged(object sender, EventArgs e) { AcceptCommand?.CanExecute(IsAcceptCommandEnabled); }
private void MainViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { AcceptCommand.RaiseCanExecuteChanged(); }