示例#1
0
        public CardsSampleView()
        {
            var cardsView = new CardsView()
            {
                ItemViewFactory = new CardViewItemFactory(RuleHolder.Rule),
                BackgroundColor = Color.Black.MultiplyAlpha(.9),
                IsPanInCourse   = true
            };

            cardsView.SetBinding(CardsView.ItemsProperty, nameof(SharedSampleViewModel.Items));
            cardsView.SetBinding(CardsView.CurrentIndexProperty, nameof(SharedSampleViewModel.CurrentIndex));

            Title          = "CardsView";
            Content        = cardsView;
            BindingContext = new SharedSampleViewModel();
        }
示例#2
0
        public SceneSampleView(double width)
        {
            var carousel = new SceneView
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var c = new ContentView();
                    c.SetBinding(BackgroundColorProperty, "Color");
                    var l = new AbsoluteLayout();
                    l.Children.Add(c, new Rectangle(.5, .5, width / 4, width / 4), AbsoluteLayoutFlags.PositionProportional);
                    return(l);
                })
            };

            var prevItem = new ToolbarItem
            {
                Text             = "**Prev**",
                Icon             = "prev",
                CommandParameter = false
            };

            prevItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            var nextItem = new ToolbarItem
            {
                Text             = "**Next**",
                Icon             = "next",
                CommandParameter = true
            };

            nextItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            ToolbarItems.Add(prevItem);
            ToolbarItems.Add(nextItem);

            carousel.SetBinding(CardsView.ItemsProperty, nameof(SharedSampleViewModel.Items));
            carousel.SetBinding(CardsView.CurrentIndexProperty, nameof(SharedSampleViewModel.CurrentIndex));

            BackgroundColor = Color.Black;
            Title           = "SceneView";
            Content         = carousel;
            BindingContext  = new SharedSampleViewModel();
        }
        public CarouselSampleView()
        {
            var carousel = new CarouselView
            {
                ItemTemplate    = new DataTemplate(() => new DefaultCardItemView()),
                BackgroundColor = Color.Black.MultiplyAlpha(.9)
            };

            carousel.Children.Add(new IndicatorsControl());

            var prevItem = new ToolbarItem
            {
                Text             = "**Prev**",
                Icon             = "prev",
                CommandParameter = false
            };

            prevItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            var nextItem = new ToolbarItem
            {
                Text             = "**Next**",
                Icon             = "next",
                CommandParameter = true
            };

            nextItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            ToolbarItems.Add(prevItem);
            ToolbarItems.Add(nextItem);

            carousel.SetBinding(CardsView.ItemsProperty, nameof(SharedSampleViewModel.Items));
            carousel.SetBinding(CardsView.CurrentIndexProperty, nameof(SharedSampleViewModel.CurrentIndex));

            Title          = "CarouselView";
            Content        = carousel;
            BindingContext = new SharedSampleViewModel();
        }
示例#4
0
        public CarouselSampleView()
        {
            var cardsView = new CarouselView()
            {
                ItemViewFactory = new CardViewItemFactory(RuleHolder.Rule),
                BackgroundColor = Color.Black.MultiplyAlpha(.9),
                IsPanInCourse   = true,
                IsRecycled      = true
            };

            var prevItem = new ToolbarItem
            {
                Text             = "**Prev**",
                Icon             = "prev",
                CommandParameter = false
            };

            prevItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            var nextItem = new ToolbarItem
            {
                Text             = "**Next**",
                Icon             = "next",
                CommandParameter = true
            };

            nextItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            ToolbarItems.Add(prevItem);
            ToolbarItems.Add(nextItem);

            cardsView.SetBinding(CardsView.ItemsProperty, nameof(SharedSampleViewModel.Items));
            cardsView.SetBinding(CardsView.CurrentIndexProperty, nameof(SharedSampleViewModel.CurrentIndex));

            Title          = "CarouselView";
            Content        = cardsView;
            BindingContext = new SharedSampleViewModel();
        }
示例#5
0
        public CardsSampleView()
        {
            var cardsView = new CardsView
            {
                ItemTemplate    = new DataTemplate(() => ViewFactory.Creator.Invoke()),
                BackgroundColor = Color.Black.MultiplyAlpha(.9),
                IsCyclical      = true
            };

            var prevItem = new ToolbarItem
            {
                Text             = "**Prev**",
                Icon             = "prev",
                CommandParameter = false
            };

            prevItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            var nextItem = new ToolbarItem
            {
                Text             = "**Next**",
                Icon             = "next",
                CommandParameter = true
            };

            nextItem.SetBinding(MenuItem.CommandProperty, nameof(SharedSampleViewModel.PanPositionChangedCommand));

            ToolbarItems.Add(prevItem);
            ToolbarItems.Add(nextItem);

            cardsView.SetBinding(CardsView.ItemsProperty, nameof(SharedSampleViewModel.Items));
            cardsView.SetBinding(CardsView.CurrentIndexProperty, nameof(SharedSampleViewModel.CurrentIndex));

            Title          = "CardsView";
            Content        = cardsView;
            BindingContext = new SharedSampleViewModel();
        }