WPF Validating unbound textbox
binding, textbox, validation, wpf
Solution
According to the MSDN forums it's not possible yet but it is planned (Note: this is an old post). However, I still can't find a way to do it so it may not be implemented yet.
Problem
is it possible to use validation without the Binding part? The thing is my textbox is not bound to any object, but I still want to validate it's content. The only way I've found so far is this: ``` <TextBox Grid.Row="0" Grid.Column="1" MaxLength="50" x:Name="textBoxTubeName" Margin="5,5,0,5"> <TextBox.Text> <Binding Path="Name" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" NotifyOnValidationError="True"> <Binding.ValidationRules> <validation:InvalidCharactersRule /> </Binding.ValidationRules> </Binding> </TextBox.Text> </TextBox> ``` But again, it only works when the TextBox.Text is bound to something (in this case, the Name property), how would I go about this without binding? Thanks!