public inputDialog(string nameVar, string initVal) { InitializeComponent(); lb_name_var.Text = nameVar; ResponseTextBox.Text = initVal; ResponseTextBox.SelectAll(); var point = Mouse.GetPosition(Application.Current.MainWindow); // HorizontalOffset = point.X; // VerticalOffset = point.Y; }
public Prompt(string title, string message, string defaultValue = "") { InitializeComponent(); Title = title; messageLabel.Text = message; InitializeComponent(); ResponseTextBox.Text = defaultValue; ResponseTextBox.Focus(); ResponseTextBox.SelectAll(); RoutedCommand saveCommand = new RoutedCommand(); saveCommand.InputGestures.Add(new KeyGesture(Key.Enter, ModifierKeys.None)); CommandBindings.Add(new CommandBinding(saveCommand, OKButton_Click)); RoutedCommand refreshCommand = new RoutedCommand(); refreshCommand.InputGestures.Add(new KeyGesture(Key.Escape, ModifierKeys.None)); CommandBindings.Add(new CommandBinding(refreshCommand, CancelDialog)); }