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}"
DataChangedHandler="{StaticResource errDialog}"


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

Label="Ship To" />

Text="{Binding Path=txtShipToName}"
Width="150" />
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