Open ghost opened 7 years ago
I have no idea,
For this line, I copied these code from Xamarin.Forms.
((ObservableCollection
NewElement.Items is Picker.Items. BindablePicker inherit from Picker
Would you please link FreshEssentials source code into your project? So that we can know what's the exception it throw.
Thanks for looking at it. Yes the next step is going to have to be linking the source so we can debug the problem.
I've pulled the source directly to debug it because I was getting the same InvalidCastException.
It's the same line, and it's because e.NewElement.Items is for some reason unable to be cast to ObservableCollection<string>
I have only observed this error on android support verison 25.1.1
I'm going to try and fix it soon (as I need it in my current project asap) and if it works for me, I'll provide a pull request.
Your binding source MUST be castable to IList
or this class will throw an error. My issue is the cast to an IList
here on line 99 in BindablePicker.cs
;
picker.ItemsSource = (IList) newValue
I have a dictionary of items I wanna show in the picker. I was trying to bind ItemsSource
to MyDictionary.Values
which is a ValueCollection
and isn't castable to IList
.
MyDictionary.Values.ToList()
fixed my issue.
View
[https://developer.xamarin.com/guides/xamarin-forms/user-interface/picker/]
This is the recommended technique, which was introduced in Xamarin.Forms 2.3.4.
And [https://developer.xamarin.com/guides/xamarin-forms/user-interface/picker/populating-itemssource/]
I have the same problem... before (using Xamarin Studio) no problem with your BindablePicker. Today (uninstalled Xamarin Studio, installe Visual Studio for Mac), the exception.
Changed BindablePicker with XF 2.4.3 Picker, it works
I had the same problem, changed code to the current code for the BindablePickerRendererDroid.cs and it works now
Hi, can you help me, I'm trying to run the example on android from VS to Mac and it does not work, do not drop the screen with the "Change source of Picker" button, it throws the same exception, I thank you. (In IOs it works),sorry for my english, it's pretty bad
I have used FreshEssentials BindablePicker in other projects fine, but am having a very strange problem with a particular Page/PageModel.
I have stripped the Page and PageModel right down to the following: Page:
PageModel:
The problem is when I run the application, I get the exception below (full stack trace truncated):
Looking at the source for the BindablePickerRendererDroid from the FreshEssentials repository, it appears to be the line:
in this method.
The strange thing is that taking the above exact code into a brand new project works fine. I have checked versions of FreshEssentials and FreshMVVM, and they're identical between the working and non-working projects.
Anyone come across this, and/or any thoughts?
Full Xamarin Studio and other version info below: