If you use Validations, you need to show the user where (and what) failed to verify, and where the AdornedElementPlaceholder comes into play. This is a Placeholder that has exactly the same UIElement size that you are checking.
Suppose you are checking user input on a TextBox and want to show a red border around the TextBox when the validation fails. Define a ValidationRule and validation template for a TextBox . If the ValidationRule fails, Validation.ErrorTemplate displayed on the TextBox . Inside the AdornedElementPlaceholder template, the Framework is informed where to place your template in the user interface. In our case, the template may look like this:
<ControlTemplate> <Border BorderBrush="Red" BorderThickness="1"> <AdornedElementPlaceholder /> </Border> </ControlTemplate>
You should read this article .
source share