|
|
|
|
@ -43,12 +43,24 @@ public class MultiFormatTextBox : Control |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Dependency Properties |
|
|
|
|
public static readonly DependencyProperty CurrentMultiFormatStringProperty = |
|
|
|
|
DependencyProperty.Register("CurrentMultiFormatString", |
|
|
|
|
typeof(MultiFormatString), typeof(MultiFormatTextBox), |
|
|
|
|
new PropertyMetadata(null, OnCurrentMultiFormatStringChanged)); |
|
|
|
|
|
|
|
|
|
public static readonly RoutedEvent EnterPressedEvent; |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// .NET Property for <see cref="EnterPressedEvent"/> |
|
|
|
|
/// </summary> |
|
|
|
|
public event RoutedEventHandler EnterPressed |
|
|
|
|
{ |
|
|
|
|
add { this.AddHandler(EnterPressedEvent, value); } |
|
|
|
|
remove { this.RemoveHandler(EnterPressedEvent, value); } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// .NET Property for CurrentMultiFormatString. |
|
|
|
|
/// </summary> |
|
|
|
|
@ -63,6 +75,11 @@ public class MultiFormatTextBox : Control |
|
|
|
|
static MultiFormatTextBox() |
|
|
|
|
{ |
|
|
|
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(MultiFormatTextBox), new FrameworkPropertyMetadata(typeof(MultiFormatTextBox))); |
|
|
|
|
|
|
|
|
|
EnterPressedEvent = EventManager.RegisterRoutedEvent("EnterPressed", |
|
|
|
|
RoutingStrategy.Bubble, typeof(RoutedEventArgs), |
|
|
|
|
typeof(MultiFormatTextBox)); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void OnApplyTemplate() |
|
|
|
|
@ -264,8 +281,10 @@ public class MultiFormatTextBox : Control |
|
|
|
|
{ |
|
|
|
|
if (e.Key == Key.Enter) |
|
|
|
|
{ |
|
|
|
|
// TODO Raise EnterPressedEvent Here |
|
|
|
|
e.Handled = true; |
|
|
|
|
// raise event |
|
|
|
|
RoutedEventArgs args = new(EnterPressedEvent); |
|
|
|
|
RaiseEvent(args); |
|
|
|
|
} |
|
|
|
|
else if(e.Key == Key.Space) |
|
|
|
|
{ |
|
|
|
|
|