Hi,
I have the following scenario:
There are two WPF user controls named, for example, PersonalInformationUserControl and AddressDetailsUserControl. The first one contains the second.
In the business layer there are 2 classes, PersonalInformation and AddressDetails. Both of them derive from BusinessBase. PersonalInformation class has an AddressDetails member type.
PersonalInformationUserControl has a CslaDataProvider that points to a PersonalInformation object. AddressDetailsUserControl uses the same CslaDataProvider as PersonalInformationUserControls but its fields are bound to the AddressDetails member of PersonalInformation object.
Furthermore, PersonalInformationUserControl has a Save button that is declared like this:
<Button x:Name="btnSave" Content="Save" Grid.Row="5" IsDefault="True"
Command="ApplicationCommands.Save"
CommandTarget="{Binding Source={StaticResource MyPerson}, Path=CommandManager, BindsDirectlyToSource=True}"/>
In the same time, the two user controls derive from EditForm class.
The two business classes have some business rules. For example, PersonalInformation applies Csla.Validation.CommonRules.StringRequired rule on FirstName property and AddressDetails applies Csla.Validation.CommonRules.StringMaxLength on BuildingName Property.
Back to UI.
At runtime, the invalid fields from PersonalInformationUserControl are marked with a red border. This won’t happen for AddressDetailsUserControl invalid fields.
Also, if AddressDetails business object become valid after PersonalInformation business object become valid, the UI won’t be updated. On the other hand, at the business layer level everything works perfectly.
Questions
1. What is the EditForm class purpose?
2. Why AddressDetailsUserControl invalid fields don’t have a red border?
3. Why the UI isn’t updated if the business objects change their status?
Please find more details in the attached project.
Thanks in advance,
Costin
This is why I'm writing the Using CSLA .NET 3.0 ebook
Copyright (c) Marimer LLC