wpf numeric only textbox

Code Example - wpf numeric only textbox

                
                        <TextBox Name="NumberTextBox" PreviewTextInput="NumberValidationTextBox"/>

-------------------------------------------------------------------------------

using System.Text.RegularExpressions;
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
    Regex regex = new Regex("[^0-9]+");
    e.Handled = regex.IsMatch(e.Text);
}