using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace WpfApplication19 { /// /// Interaction logic for EditINWindow.xaml /// public partial class EditINWindow : Window { public EditINWindow() { InitializeComponent(); var w = (MainWindow)Application.Current.MainWindow; grainSizeInput.Text = w.inStarGS; } private void saveBtn_Click(object sender, RoutedEventArgs e) { var w = (MainWindow)Application.Current.MainWindow; w.inStarGS = grainSizeInput.Text; this.Close(); } private void grainSizeInput_PreviewKeyDown(object sender, KeyEventArgs e) { if ((e.Key >= Key.D0 && e.Key <= Key.D9) || e.Key == Key.Next || e.Key == Key.Back || e.Key == Key.Delete || e.Key == Key.Left || e.Key == Key.Right) e.Handled = false; else e.Handled = true; } } }