MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

When assigning adapters should we set the original adapter's ItemSource to null #256

Open kjeremy opened 8 years ago

kjeremy commented 8 years ago

@martijn00 @Cheesebaron

We have a number of classes where we can set an Adapter and there is an inconsistency between whether or not the previous adapter is 'cleared' or not. For instance in MvxRecyclerView at the end of Adapter's set property we do:

if (existing != null)
{
    existing.ItemsSource = null;
}

However in other classes (ex MvxAppCompatRadioGroup) we do not set the ItemsSource to null. I'm inclined to think that we should clear out the old adapter since class instances don't typically share adapters.

Cheesebaron commented 8 years ago

We should probably have some kind of consistency throughout all the ItemsSource binding classes.