You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
698 B
31 lines
698 B
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Windows.Controls; |
|
using System.Windows.Input; |
|
using System.Windows.Data; |
|
using System.Windows; |
|
|
|
namespace ICSharpCode.WpfDesign.Designer.Controls |
|
{ |
|
public class EnterTextBox : TextBox |
|
{ |
|
protected override void OnKeyDown(KeyEventArgs e) |
|
{ |
|
if (e.Key == Key.Enter) { |
|
var b = BindingOperations.GetBindingExpressionBase(this, TextProperty); |
|
if (b != null) { |
|
b.UpdateSource(); |
|
} |
|
SelectAll(); |
|
} |
|
else if (e.Key == Key.Escape) { |
|
var b = BindingOperations.GetBindingExpressionBase(this, TextProperty); |
|
if (b != null) { |
|
b.UpdateTarget(); |
|
} |
|
} |
|
} |
|
} |
|
}
|
|
|