Example #1
0
        private static void ViewGroupTemplateChanged <T>(ViewGroup sender, AttachedMemberChangedEventArgs <T> args)
        {
            var container = sender as AdapterView;

            if (container == null)
            {
                var sourceGenerator = ViewGroupItemsSourceGenerator.GetOrAdd(sender);
                if (sourceGenerator != null)
                {
                    sourceGenerator.Reset();
                }
                return;
            }
            var adapter = GetAdapter(container) as BaseAdapter;

            if (adapter != null)
            {
                adapter.NotifyDataSetChanged();
            }
        }
Example #2
0
        private static void ViewGroupItemsSourceChanged(ViewGroup sender, AttachedMemberChangedEventArgs <IEnumerable> args)
        {
            var container = sender as AdapterView;

            if (container == null)
            {
                var sourceGenerator = ViewGroupItemsSourceGenerator.GetOrAdd(sender);
                if (sourceGenerator != null)
                {
                    sourceGenerator.SetItemsSource(args.NewValue);
                }
                return;
            }
            var adapter = GetAdapter(container) as IItemsSourceAdapter;

            if (adapter == null)
            {
                adapter = ItemsSourceAdapter.Factory(container, container.Context, DataContext.Empty);
                SetAdapter(container, adapter);
            }
            adapter.ItemsSource = args.NewValue;
        }