- Home
- Forum
- Xamarin.Forms
- ItemsSource doesn't contains the provided item
ItemsSource doesn't contains the provided item
Hi,
I can understand the exception below. when raising an item which isnt in the ItemSource, it throws exception but I am not sure if this is the correct way of handling this mistake. Because this exception can happen for complicated scenarios like using multiple listviews or Twoway binding, UI to UI binding. It is hard to predict this exception is coming for complex UIs. I believe that instead of throwing this exception, you should simply do "No Action", but if it is throwing this exception, It causes App to crash and this reduces productivity. Please consider not throwing an exception here. For example, xamarin forms listview wont throw exception if SelectedItem is not in the list.
thanks,
Emil
System.InvalidOperationException
ItemsSource doesn't contains the provided item
at Syncfusion.ListView.XForms.SfListView.OnSelectedItemChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0008c] in <dc1c0f4b4b8c459fb0d77f182b2319af>:0
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x0011b] in D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:597
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\agent\_work\1\s\Xamarin.Forms.Core\BindableObject.cs:391
at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x001f9] in D:\agent\_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:174
at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\agent\_work\1\s\Xamarin.Forms.Core\BindingExpression.cs:77
at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.For
SIGN IN To post a reply.
1 Reply
DB
Dinesh Babu Yadav
Syncfusion Team
January 15, 2018 06:35 AM UTC
Hi Emil,
Sorry for the inconvenience.
The reported issue “Internal Exception throws when SelectedItem data does not contain in ItemsSource in SfListView” can be resolved by catching the bind property in ViewModel to SelectedItem. You can use the try and catch for the bind property to resolve the issue at sample level.
However, we have logged a defect report for this and will be included in our upcoming 2018 Volume 1 release. We will let you know once the release has been rolled out and will appreciate your patience until then.
Please let us know if you require further assistance.
Dinesh Babu Yadav
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
EM Emil
- Jan 13, 2018 01:28 AM UTC
- Jan 15, 2018 06:35 AM UTC