Hiding validation adornment when hiding a control
问题 How, in WPF, do you hide the validation error template adornment (red box by default) when you hide a control? When I hide my controls (to facilitate switching between views) the error adornment sticks around. Even more difficult, how do I do this using MVVM? 回答1: The default ControlTemplate for the Validation.ErrorTemplate has an AdornedElementPlaceholder which in turn has a reference to its AdornedElement . It looks like this <ControlTemplate> <Border BorderBrush="Red" BorderThickness="1">