We'd like to access a TextBox (or perhaps we should use the SoftPro.Select.Controls.FieldBox class) that exists in the SoftPro UI, and bind a an event handler (ValueChanged) to it.
The particular field that we're looking at is Order.Title.TitleInsuranceCalculations.OwnersPolicy.PremiumCalculation.CoverageAmount.
How can that be done from a shell package?
Thanks
Access SoftPro TextBox
Moderator: Phil Barton
Re: Access SoftPro TextBox
I actually found a way to do this this based on the post by John Morris at viewtopic.php?f=6&t=633&p=2691&hilit=task.
First we cast the premium calculation field to an INotifyProertChanged object and add a property changed listener.
Then the handler checks for the field that was changed.
I was just wondering if there was a cleaner way to listen for changes to the CoverageAmount field itself?
Thanks
First we cast the premium calculation field to an INotifyProertChanged object and add a property changed listener.
Code: Select all
dynamic o = activeOrder;
dynamic title = o.Title;
dynamic calcs = title.TitleInsuranceCalculations;
dynamic ownersPolicy = calcs[0].OwnersPolicy;
if (ownersPolicy == null) { return; }
dynamic premiumCalculation = ownersPolicy.PremiumCalculation;
decimal coverageAmount = (decimal)premiumCalculation.CoverageAmount;
INotifyPropertyChanged premiumCalculationListener = (INotifyPropertyChanged)premiumCalculation;
premiumCalculationListener.PropertyChanged += new PropertyChangedEventHandler(premiumCalculationListener_PropertyChanged);
Code: Select all
void premiumCalculationListener_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != "CoverageAmount")
// do something
}
Thanks