TextBox with validation loses ErrorTemplate on tab change

前端 未结 3 1632
孤街浪徒
孤街浪徒 2020-12-05 04:22

I have a TextBox with a validation rule that is on a tab of a TabControl. The default ErrorTemplate correctly shows (red border around TextBox) when the validation rule fail

3条回答
  •  执笔经年
    2020-12-05 04:49

    TabItem should be defined as follows:

    
        
            
                
                    
                        
                             
                                 
                                     
                                 
                              
                          
                      
                  
              
          
      
    

    The issue is, the Validation.Error cues are painted in the Adorner Layer. When you switch tabs, that layer is discarded.

提交回复
热议问题