I created Coverter which works as number only validation for TextBoxes. Everything is fine, i use it in few places, but there is one place where it just doesn't work, i debbuged it and it works at the begining, like it was mode OneTime.
Converter:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var val = value.ToString();
return (string.IsNullOrEmpty(val) ? "" : ( (val.Substring(val.Length - 1).Equals(",") && val.Count(x => x == ',') < 2) || char.IsDigit(System.Convert.ToChar(val.Substring(val.Length - 1))) ? val : val.Substring(0,val.Length-1)));
}
And i don't know if does matters, but one time it is used in Window, and second time in Page, and it doesn't work in Page. Page:
<TextBox Name="PeselTextBox"
Margin="2,5"
Width="70"
VerticalAlignment="Center"
Text="{Binding ElementName=PeselTextBox,
Path=Text,
Mode=OneWay,
UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource NumberValidationConverter}}"/>
And in Window it is same. Tried to search for solution , but i just don't understand this error.