Reputation: 3
i have a text box binded with a mobile number and takes - after each 3 charecters.say max characters for mobile number would be 10 and after 3 character a - would be shown (Say example i have 1234567890 )(this mobile number would be replaced with 123-456-7890).
My question here is i need to remove - from the text box and make it an empty.can any one help me in this.this is all done in C# This is my code which i have tried.
this is associated property i have set
public static readonly DependencyProperty AssociatedElementProperty = DependencyProperty.Register("AssociatedElement", typeof(FrameworkElement), typeof(NumericKeyBoard), null);
this.caretPosition = associatedTextBox.SelectionStart;
if (associatedTextBox.Tag.ToString() == "mobile" && associatedTextBox.Text.Substring(this.caretPosition - 1, 1) == "-")
{
associatedTextBox.Text = associatedTextBox.Text.Remove(this.caretPosition - 1, 1);
this.caretPosition--;
}
Upvotes: 0
Views: 95