Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF- Validation -The validation error message goes behind the other controls because of AdornerDecorator
    primarykey
    data
    text
    <p>I have implemented IDataErrorInfo in my ViewModel to return a string if the text box has error.</p> <pre><code> public string this[string columnName] { get { return "Error-- This is a long error message - sd"; } } </code></pre> <p>But this error message goes behind the other control on the UI as shown below.</p> <p><img src="https://i.stack.imgur.com/92x0R.jpg" alt="alt text"></p> <p>Below is the xaml:</p> <pre><code>&lt;Window x:Class="Test.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="600" Width="600"&gt; &lt;Window.Resources&gt; &lt;ControlTemplate x:Key="validationTemplateNew"&gt; &lt;DockPanel LastChildFill="True"&gt; &lt;TextBlock Name="ErrorText" DockPanel.Dock="Bottom" Foreground="White" Background="Red" FontSize="12" Padding="2" FontFamily="Trebuchet MS" Margin="5,5,0,0" TextWrapping="Wrap" Text="{Binding [0].ErrorContent}" &gt;&lt;/TextBlock&gt; &lt;AdornedElementPlaceholder Name="ErrorTextBox" /&gt; &lt;/DockPanel&gt; &lt;/ControlTemplate&gt; &lt;Style x:Key="ValidationStyle" TargetType="{x:Type TextBox}"&gt; &lt;Style.Triggers&gt; &lt;Trigger Property="Validation.HasError" Value="True"&gt; &lt;Setter Property="BorderBrush" Value="Red" /&gt; &lt;Setter Property="BitmapEffect"&gt; &lt;Setter.Value&gt; &lt;BitmapEffectGroup&gt; &lt;OuterGlowBitmapEffect GlowColor="Red" GlowSize="3" Noise="0.6"&gt;&lt;/OuterGlowBitmapEffect&gt; &lt;/BitmapEffectGroup&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Trigger&gt; &lt;/Style.Triggers&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;ItemsControl Name="ItemCtrl"&gt; &lt;AdornerDecorator&gt; &lt;TextBox FontSize="11" Margin="10" Width="250" VerticalAlignment="Center" Text="{Binding Path=StrText, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" Validation.ErrorTemplate="{StaticResource validationTemplateNew}" Style="{StaticResource ValidationStyle}" &gt; &lt;/TextBox&gt; &lt;/AdornerDecorator&gt; &lt;TextBox Width="250" Text="ASDFASFASDFASDFASDFASDFASDF"/&gt; &lt;TextBox Width="250" Text="ASDFASFASDFASDFASDFASDFASDF"/&gt; &lt;TextBox Width="250" Text="ASDFASFASDFASDFASDFASDFASDF"/&gt; &lt;TextBox Width="250" Text="ASDFASFASDFASDFASDFASDFASDF"/&gt; &lt;TextBox Width="250" Text="ASDFASFASDFASDFASDFASDFASDF"/&gt; &lt;/ItemsControl&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <p>Please let me know how to use AdornerDecorator such that the error message overlaps the other controls and doesn't go behind.</p> <p>My application is such that if I don't use AdornerDecorator, the error message is not displayed at all. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload