OK, after some further thought this is what I came up with. Am I killing a mosquito with an ICBM?
I added a custom field property to my business object (lValidated), added a propertychanged sub for each required field, which call me.CheckRequiredFieldRules function. Then on the form, the button's, enabled property is bound to the business object.
In business object:
Private _lValidated As Boolean = False<Browsable(
False),
BusinessFieldDisplayInEditor(), _
Description("Boolean, Are All Required Fields Validated?"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property [lValidated]() As Boolean Get Return _lValidated End GetEnd PropertyProtected Overrides Function GetCustomBindablePropertyDescriptors() _ As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()
Return New FieldPropertyDescriptor() {New ReflectionPropertyDescriptor("lValidated", Me.GetType())}
End FunctionPrivate Sub CheckRequiredFieldRules() Dim llValidated As Boolean llValidated =
Me.CheckRulesOnRow() If llValidated Then Me._lValidated = True Else Me._lValidated = False End IfEnd SubPrivate Sub boParticipants_address1Changed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.address1Changed Me.CheckRequiredFieldRules()End Sub Then on the button I set:
BindingField = lValidated
BindingProperty = Enabled
BindingUpdateMode = Never
BusinessObject = boParticipants
ControlSourceUpdate = OnPropertyChanged
And I turned then little error arrows off
I took some of it from other posts. Oh, and I know I could use an IIF() instead of If..then. One thing I like is that all the logic is in the Business Object.
Thanks
Marcel