I have a BusinessBase descendant that is composed of a few string properties as well as a single ReadOnlyBase object.
Simplified version:
Public Class ROZipCode
Inherits ReadOnlyBase
private _ZipCode as string
private _County as string
private _State as string
public readonly property ZipCode as string …
public readonly property CountyName as string …
public readonly property StateName as string …
...
End Class
Public Class Location
Inherits BusinessBase
private _LocName as string
private _LocDescription as string
private _LocZIP as ROZipCode
public property LocName as string ...
public property LocDescription as string
public property LocZIP as ROZipCode
‘ ... get/set methods (CheckRules & MarkDirty called on set) for all properties
‘ … DataAccess/ Shared Methods and the rest needed
End Class
Public Class EditLocationForm
Inherits System.Windows.Forms.Form
…
Public Sub BindFields()
‘BindField for each Location property including LocZIP binded to a ButtonEdit ‘descendant that returns an ROZipCode.
‘ I’m also binding LocZIP properties to readonly text boxes for display purposes.
BindField(CheckBox1, “Checked”, SomeLocation, “IsDirty”)
BindField(TextBox1, “Text”, SomeLocation, “LocName”)
BindField(CustomLookupEdit1, “Text”, SomeLocation, “LocZIP”) 'Bound to a ROZipCode object
BindField(TextBox11, “Text”, SomeLocation.LocZIP, “CountyName”)
BindField(TextBox12, “Text”, SomeLocation.LocZIP, “StateName”)
End sub
The CustomLookupEdit control is a descendant of a devexpress ButtonEdit control which through the Format/Parse mechanism “converts” a ROZipCode to text and back again; it also does some lookup and search functions. In the end it returns a ROZipCode to it’s bound property. This I know is working fine because the LocZIP property of SomeLocation changes accordingly whenever the custom control looks up a different zip code.
The problem is that although it’s value changes correctly within the Location instance, the textboxes to which the LocZIP properties are bound to (TextBox11, TextBox12) don’t get refreshed.
Why is this? At first I had forgatten to bind the checkbox to SomeLocation.IsDirty, but I’ve since corrected that and still no-go.
I’ve done my fair share of research on both searchcsla.com and this forum to no‑avail.
Can some one point me in the right direction, I’m sure the answer to this is lurking somewhere but I Still Haven’t Found What I’m Looking For …
Thanks
Mario Estrella
The solution I'm using right now is trapping the Validated event for the custom lookup control from the EditLocationForm and do a re-bind. This works fine, but I dont think I should have to do it.
Is there a better approach to this?
Thanks
xal:I didn't read all the discussion, so forgive me if I'm off the subject...
But if you have a readonly property that changes based on others, you could override on property changed like:
Protected Overrides Sub OnPropertyChanged(propertyName as string)
If propertyName = "PropA" Or propertyName = "PropB" Then
PropertyHasChanged ("TheReadOnlyProp")
End If
End Sub
Andrés
I'm still using CSLA 1.5 ... doing a little research it seems the IPropertyChanged interface is for CSLA 2.0 or at least .NET 2.
Am I correct? if so, is there something similar for CSLA 1.5?
Copyright (c) Marimer LLC