C#[PropertyEditor(typeof(decimal),false)]
public class CustomCurrencyDecimalPropertyEditor : DecimalPropertyEditor
{
public CustomCurrencyDecimalPropertyEditor(Type objectType, IModelMemberViewItem info) :
base(objectType, info) {
}
protected override void SetupRepositoryItem(RepositoryItem item)
{
base.SetupRepositoryItem(item);
RepositoryItemDecimalEdit DecimalProperty = (RepositoryItemDecimalEdit)item;
DecimalProperty.Buttons[0].Visible = false;
try
{
var CurrentObject = View.CurrentObject;
Type CurrentObjectType = CurrentObject.GetType();
Currency Currency = (Currency)CurrentObjectType.GetProperty("Currency").GetValue(CurrentObject);
DecimalProperty.Mask.Culture = CultureInfo.GetCultureInfo(Currency.Culture.CultureID);
DecimalProperty.DisplayFormat.Format = DecimalProperty.Mask.Culture.NumberFormat;
}
catch(Exception Ex)
{
}
}
}
I have a currency and amount fields in a screen. The amount fields should be formatted based on the currency selected. I have created a custom decimal property editor for this. The editor works fine when the screen is opened freshly. But when the screen is in edit mode, when the currency is changed , the editor is not being invoked and so the amount field is not formatted based on the current currency. I have applied immediatePostData for currency field in the screen. Can you please help to find out what I am missing here. Thanks in Advance.