Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SupportActionBar.SetHomeAsUpIndicator(Resources.GetDrawable(Resource.Drawable.ic_launcher));

            topPagerAdapter  = new TopCarouselViewAdapter(this, Resource.Layout.layout_notification_item, FillTopPager);
            topPager         = FindViewById <ViewPager>(Resource.Id.TopCarouselView);
            topPager.Adapter = topPagerAdapter;
            topPager.SetClipToPadding(false);
            topPager.PageMargin = 12;

            FindViewById <TabLayout>(Resource.Id.tlTopPagerDotIndicator).SetupWithViewPager(topPager, true);

            bottomPagerAdapter  = new TopCarouselViewAdapter(this, Resource.Layout.layout_weather_notification_item, FillBottomPager);
            bottomPager         = FindViewById <ViewPager>(Resource.Id.BottomCarouselView);
            bottomPager.Adapter = bottomPagerAdapter;
            bottomPager.SetClipToPadding(false);
            bottomPager.PageMargin = 12;

            FindViewById <TabLayout>(Resource.Id.tlBottomPagerDotIndicator).SetupWithViewPager(bottomPager, true);

            favLocations = FindViewById <MvxListView>(Resource.Id.lvFavouriteLocations);
            //favLocations.SetListViewHeightBasedOnChildren();
            //favLocations.SetOnTouchListener(this);

            this.AddLinqBinding(ViewModel, vm => vm.FavouriteLocations, list =>
            {
                if (list?.Count > 0)
                {
                    ViewGroup.LayoutParams layoutParameters = favLocations.LayoutParameters;
                    favLocations.LayoutParameters           = new FrameLayout.LayoutParams(layoutParameters.Width, 42 * list.Count);
                }
            });

            this.CreateBinding(topPagerAdapter).For(adapter => adapter.DataSource).To <HomeViewModel>(vm => vm.NotificationModelsList).Apply();
            this.CreateBinding(bottomPagerAdapter).For(adapter => adapter.DataSource).To <HomeViewModel>(vm => vm.WeatherNotificationModelsList).Apply();
        }
Пример #2
0
 public ViewPagerTargetBinding(TopCarouselViewAdapter target) : base(target)
 {
 }