We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Implementing MVVM pattern

The requirement is to allow users to select options for a string field implementing either the DropDown and Picker editors in a MVVM pattern.
Kindly refer me to a example(s) of how to achieve this correctly without going down the code behind route.

3 Replies

MK Muneesh Kumar G Syncfusion Team May 1, 2019 10:57 AM UTC

Hi Lan, 
 
Thanks for using Syncfusion products.  
 
We have prepared a sample based on your requirement using MVVM pattern. Please download the sample from the below link. 
 
 
Please let us know, if you have any other concern 
 
Regards,
Muneesh Kumar G.   
 



IA Ian May 5, 2019 10:29 AM UTC

Good day,

Thank you for your response - it covers the MVVM example of a SfPicker 100%.
My requirement relates to the picker/dropdown editor found as part of the SfDataForm solution.
Typically I need to populate the items in the dropdown or picker editor with values supplied from a view model class.
So far I have only found examples of doing it behind. My own attempts to use a binding approach has failed.

xaml:      <dataform:DataFormDropDownItem Editor ="DropDown" Name="Cause" />

code behind:
         public class SourceProviderExt : SourceProvider
        {
            public override IList GetSource(string sourceName)
            {
                var ItemList = new List<string>();
              
                if (sourceName == "Cause")
                {
                    ItemList.Add("Wear and tear");
                    ItemList.Add("Manufacturer prescription");
etc


SP Subburaj Pandian Veluchamy Syncfusion Team May 6, 2019 09:17 AM UTC

Hi Ian, 
 
Thank you for the update.

We have already found and working on this mentioned issue “Binding ItemSource property to the DataForm DropDown Editor not working” with high priority and logged issue report for the same. We will fix this issue and include the issue fix in our upcoming 2019 Volume 1 Service Pack 1 release which is expected to be available by mid of May 2019. We appreciate your patience until then.   

You can track the status of this report through the following feedback link,  
  
 
Regards,
Subburaj Pandian V 


Loader.
Live Chat Icon For mobile
Up arrow icon