Using WPF Validation rules and the disabling of a 'Save' button

前端 未结 10 2092
眼角桃花
眼角桃花 2020-11-28 09:54

I have a page where a few textboxes cannot be empty before clicking a Save button.


                            


        
10条回答
  •  醉酒成梦
    2020-11-28 10:34

    This website has the code you're looking for: https://www.wpfsharp.com/2012/02/03/how-to-disable-a-button-on-textbox-validationerrors-in-wpf/

    For posterity the button code should look like this if you are using a ValidationRule override on the input fields:

    
    

提交回复
热议问题