WPF validation Help

WPF validation Help

Old forum URL: forums.lhotka.net/forums/t/8338.aspx


npatel posted on Tuesday, January 12, 2010

I have the following snipets in my code:

ObjectType="{x:Type Shipping:Shipment}"
FactoryMethod="GetShipment"
IsAsynchronous="True"
IsInitialLoadEnabled="False"
DataChangedHandler="{StaticResource errDialog}"
ManageObjectLifetime="True">

0




on my form I have the following controls bound:
VerticalAlignment="Top"
DataContext="{Binding Source={StaticResource ShipmentStops}}">
IsSynchronizedWithCurrentItem="True"
DataSource="{Binding}" >

Label="Ship To" />


Text="{Binding Path=txtShipToName}"
Width="150" />
Grid.Row="3"
Property="{Binding Path=ShipToName, Mode=TwoWay}"
TargetControl="{Binding ElementName=txtShipToName}"
HorizontalAlignment="Left" />


When a new shipment is created, it automatically creates a ShipmentStop record by default.
The ShipmentStop has a validation setup to make sure that the property is populated.
The Grid is showing the validation error. However the textbox bound to the same property does not.
What am I missing?

RockfordLhotka replied on Wednesday, January 13, 2010

Do you have a PropertyStatus control next to that TextBox? The TextBox doesn't know about validation, you use a PropertyStatus to display that information.

npatel replied on Thursday, January 14, 2010

Yes, the propertyStatus control is next to the textbox. The propertyStatus control does not display the validation error message. However, the datagrid displays the validation error message.

Copyright (c) Marimer LLC