This project has moved and is read-only. For the latest updates, please go here.

RichTextBox Error validation not working on Lostfocus

Nov 21, 2011 at 9:37 AM
Edited Nov 21, 2011 at 9:40 AM
   

Hi All,

Please go through with the following xaml code. I am looking for error validation in RichTextBox contro it is not working when UpdateSource trigger set to 'LostFocus'.

 <ext:RichTextBox x:Name="CommentsTextArea" Text="{Binding Path=SupplierCode,Mode=TwoWay,ValidatesOnDataErrors=True}" HorizontalAlignment="Left" Height="55.5" Margin="149.667,0,0,77.875" VerticalAlignment="Bottom" Width="550" FontSize="10.667"></ext:RichTextBox>

Also the Customization of warning images not working. Please go throught with the following Style.

 
            <Style TargetType="{x:Type ext:RichTextBox}" BasedOn="{StaticResource {x:Type ext:RichTextBox}}">
                <Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <DockPanel LastChildFill="true">
                                <Border Background="Red" DockPanel.Dock="right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10"
                            ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                                    <TextBlock Text="!" VerticalAlignment="center" HorizontalAlignment="center" FontWeight="Bold" Foreground="white">
                                    </TextBlock>
                                </Border>
                                <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center" >
                                    <!--<Border BorderBrush="red" BorderThickness="1" />-->
                                </AdornedElementPlaceholder>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

Hopping for the better solution.

Thanks and Regards,

Sakthi