Validation.HasError attached property

Posted by Nima on Stack Overflow See other posts from Stack Overflow or by Nima
Published on 2010-05-16T07:11:55Z Indexed on 2010/05/16 7:20 UTC
Read the original article Hit count: 274

Filed under:
|
|
|

Did I miss something?

1- Style

 <Style TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Path=Validation.HasError}" Value="true">
                <Setter Property="BorderBrush" Value="Blue" />
            </DataTrigger>
        </Style.Triggers>
        <Setter Property="MinWidth" Value="160" />
        <Setter Property="Margin" Value="0 7 0 0"/>
    </Style>

2 - Viewmodel implement IDataErrorInfo 3- textBox in view

 <TextBox x:Name="FirstName" Text="{Binding Person.FirstName,  UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=true}"></TextBox>

3 - I use Caliburn MVVM

I got " BindingExpression path error: 'Validation' property not found on 'object' ''PersonWindowViewModel' (HashCode=38783181)'. BindingExpression:Path=Validation.HasError; DataItem='PersonWindowViewModel' (HashCode=38783181); target element is 'TextBox' (Name='FirstName'); target property is 'NoTarget' (type 'Object')"S

© Stack Overflow or respective owner

Related posts about wpf

Related posts about mvvm