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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

147887 Sep 26,2019 08:54 PM UTC Sep 30,2019 10:44 AM UTC Xamarin.Forms 4
loading
Tags: SfComboBox
Jake Edwards
Asked On September 26, 2019 08:54 PM UTC

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

Kanimozhi Gunasekaran [Syncfusion]
Replied On 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.

Jake Edwards
Replied On 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

Jake Edwards
Replied On 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

Muneesh Kumar G [Syncfusion]
Replied On 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. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon