Hi
I have the problem that I need switch controls in data forms. I tried several ways to set the colour but none of the methods I have chosen worked on the platforms UWP, Android and iOS. What is the correct way to set the OnColor for a switch in a SFDataForm control?
One of the ways I feel should be working is creating a customer editor like the following:
public class CustomSwitchEditor : DataFormSwitchEditor
{
public CustomSwitchEditor ( SfDataForm dataForm ) : base(dataForm)
{
}
protected override void OnInitializeView ( DataFormItem dataFormItem, Switch view )
{
base.OnInitializeView(dataFormItem, view);
view.OnColor = (Color)Helpers.ThemeManager.GetResourceValue("PrimaryColor");
}
}The registration of the control is done in the behaviour method OnAttachTo of the dataform control like the following:0
_dataForm.RegisterEditor("Switch", new CustomSwitchEditor(_dataForm)); _dataForm.RegisterEditor("IsActive", "Switch");The above method works on UWP, don't on Android and partial on iOS.
Many thanks for the help.
Kind regards,
Bruno
Hi Zimmermann,
#Regarding How to set the OnColor of a switch in a SFDataForm
We regret to inform you that due to the complexity in fixing the issue, we could not include the fix in our weekly nuget release as promised. We will fix the reported issue and include it in our upcoming Weekly nuget release which is planned to roll out on April 26, 2022. We will let you once the release is rolled out and appreciate your patience until then.
Regards,
SaiGanesh Sakthivel
Hi Zimmermann,
#Regarding Dynamic color changing is not applying for the DataFormSwitchEditor
We
have fixed the reported issue and included the issue fix in our latest Weekly
NuGet release update version 20.1.0.51 onwards which is
available for download (nuget.org).
We thank you for your support and appreciate your patience in waiting for this update. Please get in touch with us if you would require any further assistance.
Regards,
SaiGanesh Sakthivel
HI SaiGanesh
I verified the change with the latest build and it works fine on Windows 10, Android and iOS.
Many thanks for your support.
Regards,
Bruno
Hi Zimmermann,
We are glad to know that the provided solution is resolved the issue. Please let us know if you need any further assistance.
Regards,
SaiGanesh Sakthivel