private void searcher_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { SetCurrentItemNew(); Skiplostfokus = true; visior.Focus(); return; } if (e.Key == Key.F6) { popi.IsOpen = false; LookUpSelector contragenSelector = new LookUpSelector(DataContext as SaldoItem); contragenSelector.ShowDialog(); var dat = DataContext as SaldoItem; if (contragenSelector.DialogResult.HasValue && contragenSelector.DialogResult.Value) { var data = contragenSelector.dg.ItemsSource2D as ObservableCollection <ObservableCollection <string> >; if (data != null) { if (contragenSelector.dg.SelectedIndex != -1) { var dat1 = data[contragenSelector.dg.SelectedIndex + 1]; if (dat != null) { dat.LiD = 0; dat.Value = dat1[0]; dat.Lookupval = dat1[1]; if (dat1.Count > 4) { dat.Bulstad = dat1[3]; dat.Vat = dat1[4]; } dat.LiD = dat.GetLookUpId(0); OnRefreshExecuted(new FastLookupEventArgs(dat)); } } } } e.Handled = true; visior.Visibility = Visibility.Visible; searcher.Visibility = Visibility.Hidden; } }
private void visior_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F6) { popi.IsOpen = false; LookUpSelector contragenSelector = new LookUpSelector(DataContext as SaldoItem); contragenSelector.ShowDialog(); if (contragenSelector.DialogResult.HasValue && contragenSelector.DialogResult.Value) { var data = contragenSelector.dg.ItemsSource2D as ObservableCollection <ObservableCollection <string> >; var dat = DataContext as SaldoItem; if (data != null) { if (contragenSelector.dg.SelectedIndex != -1) { var dat1 = data[contragenSelector.dg.SelectedIndex + 1]; if (dat != null) { dat.Value = dat1[0]; dat.Lookupval = dat1[1]; if (dat1.Count > 4) { dat.Bulstad = dat1[3]; dat.Vat = dat1[4]; } dat.LiD = dat.GetLookUpId(0); OnRefreshExecuted(new FastLookupEventArgs(dat)); } } } } e.Handled = true; return; } if (e.Key == Key.Enter) { var sendy = sender as TextBoxEx; if (sendy != null && string.IsNullOrWhiteSpace(sendy.Text)) { var dat = DataContext as SaldoItem; if (dat != null) { dat.Value = ""; dat.Lookupval = ""; } } } var _keyConv = new KeyConverter(); string keyPressed = _keyConv.ConvertToString(e.Key); if (keyPressed != null && keyPressed.Length == 1 || keyPressed.Contains("NumPad")) { if (char.IsLetterOrDigit(keyPressed[0])) { { searcher.Visibility = Visibility.Visible; visior.Visibility = Visibility.Hidden; searcher.Text = ""; searcher.Focus(); } } } }