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
close icon

Loading multiple selected values into a combo box's SelectedValue property via MVVM results in an exception on iOS

Hello,

After updating to the latest version of Xamarin forms(3.6.0.344457 as of writing this) while utilizing version 17.2.0.46 of the Syncfusion Xamarin controls, I began receiving a specified cast is not valid exception when trying to load multiple selected values into a SfComboBox. Specifically I'm seeing this happening on iOS, but I've not tried testing it on Android. I have attached a demo solution that reproduces this behavior, the entire stack trace doesn't seem to fit in this description box but the demo solution is setup in a way that the error is readily reproducable. All that is required is to try and navigate to the Multiple Selection tab and it will reproduce the error. If there is an issue decompressing the 7z file let me know. I had to use some different settings to get the file small enough to  pass the 30MB limit.

My dev environment when reproducing this:

Visual Studio Professional 2019 (Version 16.3.1) / Visual Studio For Mac Community (Version 8.3 Build 1805)

Microsoft .NET Framework
Version 4.8.03752

Syncfusion Xamarin Project Templates   13.4.0.53

Syncfusion Xamarin Toolbox   16.2.0.19

SyncfusionMenu Extension   1.0

VisualStudio.Mac   1.0

Xamarin   16.3.0.274 (d16-3@06531f8)

Xamarin Designer   16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)

Xamarin Templates   16.3.565 (27e9746)

Xamarin.Android SDK   10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: mono/mono/2019-06@7af64d1ebe9
    Java.Interop: xamarin/java.interop/d16-3@5836f58
    LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
    LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
    ProGuard: xamarin/proguard/master@905836d
    SQLite: xamarin/sqlite/3.27.1@8212a2d
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333


Xamarin.iOS and Xamarin.Mac SDK   13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.



Attachment: ComboBox_e4abf0b0.7z

4 Replies

KG Kanimozhi Gunasekaran Syncfusion Team September 27, 2019 06:09 PM UTC

Hi Jake Edwards,

Greetings from Syncfusion.

We have checked the reported issue in SfComboBox from our side. We are unable to reproduce the reported issue with given SampleBrowser sample with latest nuget. And also, please let us know if you have modified the SampleBrowser sample files or you have used the same sample to reproduce the issue.

Can you please provide the video for the issue reproduced? which will be helpful for us to analyze further and provide an appropriate solution.

Regards,
Kanimozhi G.


JE Jake Edwards September 27, 2019 07:16 PM UTC

Yes, I have modified the SampleBrowser sample files. In the attached solution from the first comment it has the exact issue reproduced. I have attached a video of the issue happening with the solution that was provided.
Attachment: SampleBrowser.SfComboBox__Microsoft_Visual_Studio_20190927_135318_9a75be69.7z


JE Jake Edwards September 27, 2019 07:32 PM UTC

Here is a zip file with the two modified files from the sample browser sample files. In particular, these files are located in: 
{your local syncfusion install location}\Syncfusion\Xamarin\17.2.0.46\sample\Forms\ComboBox\ComboBox\Samples\ToleratingTypos.

the lines modified in the files provided are: 

ToleratingTypos.xaml (24) I've added a SelectedItem property that will be bound to a property called SelectedItem2. 
I gathered this approach from the following example:

ToleratingTypos.xaml.cs (113) adding a private backing field called _selectedItem2 in SelectionIndicatorViewModel for the property that will be used to bind the selected item to the ComboBox.

ToleratingTypos.xaml.cs (125 - 133) Adding a property called SelectedItem2 to SelectionIndicatorViewModel that will be used to bind the selected item to the ComboBox.

ToleratingTypos.xaml.cs (154) Adding the top two of the list items from the appCollection field to serve as initial selected values in the ComboBox on load. This is to simulate a scenario where a user would load previously selected values into the combo box.



Attachment: ModifiedFiles_c5978ae6.zip


MK Muneesh Kumar G Syncfusion Team September 30, 2019 10:44 AM UTC

Hi Jake,

We have checked the modified file in ToleratingTypos and we would like to let you know that the same collection need to be given for the SelectedItem to be set in the SfComboBox Control.

Modified File:
 https://www.syncfusion.com/downloads/support/directtrac/general/ze/ToleratingTypos320709490

Screenshot:
 


Please check with the modified solution and let us know if you have any concern.
 
 
Thanks, 
Muneesh Kumar G. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon