In order to correctly add or remove the hyphen you should handle for example
UIElement.KeyDown Event (System.Windows)[
^] . In the event handler, check if the user is adding text or removing it (backspace pressed). Also you need to take into consideration if delete key is pressed and/or if an area of text is selected and the caret position in the text.
There are quite a few example, like
How To Implement a Mask for a Text Box in W.P.F.[
^]. However, perhaps the easiest way would be to use a ready made control from
Extended WPF Toolkit™[
^]