BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi!
I'm migrating my project to MAUI and I didn't find this ItemManager method.
It's the same code from this link in Xamarin
https://www.syncfusion.com/forums/166358/dynamic-fields-in-dataforms
Can you help me?
Hi Davi,
Currently, we are checking the reported scenario from our end. We will update you on the further details on February 2, 2023. We appreciate the patience until then.
Regards,
SaiGanesh Sakthivel
Hi Davi,
Currently, the dataform do not have support to exact the Items class and support to generate the items with custom data dictionary. We have logged the feature request for ‘Custom data dictionary support to generate the items in the SfDataForm’. We will implement this feature in our 2023 Volume 2 release which is expected to roll out in the month end of June, 2023. We appreciate your patience until then.
You can track the status of this report through the following feedback link,
Regards,
SaiGanesh Sakthivel
Davi,
We are glad to announce that our Essential Studio 2023 Volume 2 Main Release V22.1.34 is rolled out and the ‘Custom data dictionary support to generate the items in the SfDataForm’ is available for download under the following link.
Release note: https://help.syncfusion.com/maui/release-notes/v22.1.34?type=all#sfdataform-features
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
SaiGanesh Sakthivel
Hi!
I updated and when running I'm still having a problem.
I used the Xamarin model. https://www.syncfusion.com/forums/166358/dynamic-fields-in-dataforms
Could you give me an example of how to do it following this model in Maui?
I'm using the git example but I can't access the data binding
Hi Davi,
You can achieve your requirement by implementing the "DataFormItemManager" in the.NET MAUI SfDataForm control, as illustrated in the below UG documentation. Please refer to the following link to access the sample: https://github.com/SyncfusionExamples/maui-dataform/tree/master/CustomDataDictionarySample
We hope that this helps you. If you need any further assistance, please let us know.
Hi Vidyalakshmi Mani!
Can you help me?
I changed the Syncfusion example to have a viewmodel.
How to get data?
Hi Davi,
Based on our analysis of the provided sample, we discovered that the problem was caused by an incorrectly set binding context for the view model. Consequently, we corrected it, and we have uploaded the revised sample here.
We hope that this helps you. Please let us know if you need further assistance.
Hi!
The attached example is missing a file.
Hi Davi,
Thank you for notifying us about the missing file. We have restored it and successfully uploaded it for your convenience.
Please let us know if you require any further assistance.
Hi!
The example worked, but I need to pass a parameter.
I changed the example, because I need to pass a parameter to identify which items will appear.
Can you help me?
Attachment: CustomDataDictionarySample_36e41f24.zip
HI Davi,
We found that the reported scenario was brought on by a misconfigured binding context for the view model based on our analysis of the sample that was given. It would be appropriate to set the binding context for the view model in the behaviour class rather than the main page , and setting the binding for the DataObject in the main page is not required. Please refer to the below code snippets for the changes made. Therefore, we made the necessary corrections and uploaded the updated sample here.
Code snippet:
protected override void OnAttachedTo(SfDataForm dataForm) { base.OnAttachedTo(dataForm); dataForm.BindingContext = new MainViewModel(1);
Dictionary<string, object> dictionary = (dataForm.BindingContext as MainViewModel).listDictionary;
} |
We hope that this helps you. Please let us know if you need further assistance.
Hi Vidyalakshmi Mani!
Sorry if I didn't express it correctly or if I didn't understand something!
I get any parameter (integer example) in the viewmodel, but how to get that parameter in the method:
protected override void OnAttachedTo(SfDataForm dataForm)?
You put fixed 1, but I don't know which one came in the viewmodel and how to get it!
I just need access to the data loaded into the viewmodel.
Hi Davi,
Regarding “how to get parameter in the method protected override void OnAttachedTo(SfDataForm dataForm)”:
We have checked the reported query. Since, OnAttachedTo() is a framework level method we cannot pass parameter to that method. As mentioned earlier you can pass parameter to the viewmodel and in the viewmodel class you can pass that to a method, as shown in the below code snippet.
[C#]:
public MainViewModel(int id) {
AccessListDictionary(id); }
private void AccessListDictionary(int id) { listDictionary = new Dictionary<string, object>(); if (id == 1) { listDictionary.Add("Name", "John"); listDictionary.Add("Password", "1234"); listDictionary.Add("Check", true); listDictionary.Add("Switch", true); listDictionary.Add("DoB", DateTime.Now.Date); } else { listDictionary.Add("Name", "John"); listDictionary.Add("Time", DateTime.Now); listDictionary.Add("Address", ""); listDictionary.Add("Picker", "one"); listDictionary.Add("ComboBox", "two"); listDictionary.Add("AutoComplete", "three"); listDictionary.Add("RadioGroup", "one"); } } |
We hope that this helped you. Please let us know if you need further assistance.
Regards,
Vishal O.
Hi Vishal Omprasad!
I did that however the OnAttachedTo method - CustomDataBehavior.cs
occurs before loading listDictionary - MainViewModel.cs
Could you please change the attached example so that it works?
Hi Davi,
Regarding “OnAttachedTo() method occurs before load listDictionary”:
As per the flow in .NET MAUI, when using behavior, after the InitializeCompoment() method is invoked, the flow will move to the OnAttachedTo() method in the behavior class leaving the subsequent lines of code below the InitializeCompoment() method. Due to this reason, in our previous response we specified to set the binding context for the ViewModel in the Behavior class rather than in the MainPage’s code behind or you can define the ViewModel’s contructor without parameter and set the binding context in the MainPage.xaml itself. Also, after analysing the sample you have shared, we found that you are returning if the binding context is null, which will display no data in the output.
We have modified your shared sample and attached below. We hope that this helped you. Please let us know if you need further assistance.
Regards,
Vishal O.