3 using System.Globalization;
5 using System.Windows.Controls;
6 using System.Windows.Data;
8 namespace SiliconStudio.Presentation.Behaviors
15 private bool updatingText;
19 AssociatedObject.TextChanged += TextChanged;
24 AssociatedObject.TextChanged -= TextChanged;
27 private void TextChanged(
object sender, TextChangedEventArgs e)
32 char newChar =
default(
char);
33 foreach (var change
in e.Changes.Where(change => change.AddedLength > 0))
35 newChar = AssociatedObject.Text[change.Offset + change.AddedLength - 1];
37 if (newChar !=
default(
char))
40 AssociatedObject.Text = newChar.ToString(CultureInfo.InvariantCulture);
45 BindingExpression expression = AssociatedObject.GetBindingExpression(TextBox.TextProperty);
46 if (expression != null)
47 expression.UpdateSource();