How to set the OnColor of a switch in a SFDataForm

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



7 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team March 21, 2022 01:29 PM UTC

Hi Zimmermann,

#Regarding How to set the OnColor of a switch in a SFDataForm
 
Currently, we are analyzing the reported scenario from our end. We will update the further details on the March 23, 2022. We appreciate the patience until then. 
 
Regards,
SaiGanesh Sakthivel
 



SS SaiGanesh Sakthivel Syncfusion Team March 23, 2022 12:44 PM UTC

Hi Zimmermann, 
 
#Regarding How to set the OnColor of a switch in a SFDataForm  
Currently, we are analyzing the reported scenario in our source level. We will update the further details on the March 25, 2022. We appreciate the patience until then.  
  
Regards,
SaiGanesh Sakthivel
  



SS SaiGanesh Sakthivel Syncfusion Team March 25, 2022 01:10 PM UTC

Hi Zimmermann, 
 
#Regarding Dynamic color changing is not applying for the DataFormSwitchEditor 
We have logged the issue report for the same. We will fix the issue and include the issue fix in our Weekly nuget release which is expected to roll out on April 19,2022. We appreciate your patience until then.  
  
You can track the status of this report through the following feedback link,  
  
Note: The provided feedback link is private, you need to login to view this feedback.  
  
Regards,  
SaiGanesh Sakthivel  



SS SaiGanesh Sakthivel Syncfusion Team April 19, 2022 01:41 PM UTC

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



SS SaiGanesh Sakthivel Syncfusion Team April 26, 2022 01:46 PM UTC

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


Marked as answer

ZI Zimmermann May 4, 2022 09:52 AM UTC

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 



SS SaiGanesh Sakthivel Syncfusion Team May 5, 2022 09:50 AM UTC

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


Loader.
Up arrow icon