I have an content page that contain a registration form,and this page controled by a configuration page(visible,editable,disable). so when this page load the configuration data,few times disable option not woking.and in that case form fields loaded incorrectly.
if (!string.IsNullOrEmpty(PriorityValue))
{
if (PriorityValue == "Editable")
{
Priority.IsEnabled = true;
PriorityLbl.IsVisible = true;
}
else if (PriorityValue == "ReadOnly")
{
Priority.IsEnabled = false;
PriorityLbl.IsVisible = true;
}
else
{
Priority.IsVisible = false;
PriorityLbl.IsVisible = false;
}
}
after put this code under:
Device.BeginInvokeOnMainThread(() =>
{
Priority.IsEnabled = true;
PriorityLbl.IsVisible = true;
});
Then it will works fine.
so is it a good solution for controling visibility for each fields?