private void UpdateContentTemplate() { Child = ContentTemplate?.LoadContent() as UIElement; if (Child == null) { return; } this.textBox = ((FrameworkElement)Child)?.FindName("entry") as TextBoxEx; if (this.textBox == null) { throw new InvalidOperationException("Need an entry TextBoxEx for EntryPopup"); } }
protected override void OnPreviewKeyDown(KeyEventArgs e) { ratioTextBox = e.Source as TextBoxEx; var incValue = e.KeyboardDevice.IsKeyDown(Key.LeftShift) || e.KeyboardDevice.IsKeyDown(Key.RightShift) ? 10 : 1; switch (e.Key) { case Key.Up: // Increment Value ValueChanged(ratioTextBox.Text, ratioTextBox.CaretIndex, ratioTextBox.SelectionLength, incValue); e.Handled = true; break; case Key.Down: // Decrement Value ValueChanged(ratioTextBox.Text, ratioTextBox.CaretIndex, ratioTextBox.SelectionLength, -incValue); e.Handled = true; break; } base.OnPreviewKeyDown(e); }