Hi Team,
We think EnabledIf attribute have an UI refresh issue, if the value is set also , it is not reflected in the UI in some cases.
Let me explain,
I have a combo box, which is of KindOfLimits (ENUM) type
public KindOfLimits Kinds
{
get { return this.kinds; }
set
{
this.kinds = value;
this.OnPropertyChanged(nameof(this.Kinds));
}
}
I have an custom control (IControlProvider) which will be enabled only if KindOfLimits== NominalTolerance and AssignVaribaleFrom==UserInput.
[ConvertToArrayViewIfCanAttribute(nameof(Tolerance), nameof(DataTypeSelected))]
[EnabledIf(nameof(AssignVaribaleFrom), AssignmentType.UserInput, HideIfDisabled = true)]
[EnabledIf(nameof(Kinds), KindOfLimits.NominalTolerance, HideIfDisabled = true)]
[Display("Check", Order: 0.1)]
public string Tolerance
{
get;set;
}
About our custom control(ConvertToArrayViewIfCanAttribute):
Depending on the datatype selected custom control will display a textbox or a combobox.
Problem we face :
For the first time when we assign value to Kinds and AssignVaribaleFrom . UI is not updated.
When we click on another test step and come back then UI will be okay.
Work Around we do:
if we do the following way then it is okay.
Task.Run(() =>
{
Thread.Sleep(200);
this.OnPropertyChanged(nameof(this.Tolerance));
});
eg:
public KindOfLimits Kinds
{
get
{
return this.kinds;
}
set
{
this.kinds = value;
this.OnPropertyChanged(nameof(this.Kinds));
Task.Run(() =>
{
Thread.Sleep(200);
this.OnPropertyChanged(nameof(this.Tolerance));
});
}
}