I work with C # - WPF and I have a field where the client can enter their full name. I would like to validate where it can not enter only the first name if it does not open a blocking message. That is, he would need to enter at least two names.
I tried to do this, but it only takes the spaces that come before the first name
bool espaco= txtBox1.Text.Length>0 && txtBox1.Text.Trim().Length==0;
if (espaco){
MessageBox.Show("Erro");
}
I can understand, otherwise I try to explain better ... Help me