예제 #1
0
        public MonkeysPage()
        {
            Title = "Monkeys";

            var list      = new ListView();
            var viewModel = new MonkeysViewModel();

            list.ItemsSource = viewModel.Monkeys;

            var cell = new DataTemplate(typeof(TextCell));

            cell.SetBinding(TextCell.TextProperty, "Name");
            cell.SetBinding(TextCell.DetailProperty, "Location");

            list.ItemTemplate = cell;

            list.ItemTapped += (sender, args) =>
            {
                var monkey = args.Item as Monkey;
                if (monkey == null)
                {
                    return;
                }

                Navigation.PushAsync(new DetailsPage(monkey));
                // Reset the selected item
                list.SelectedItem = null;
            };

            Content = list;
        }
예제 #2
0
 public override void Awake(NSObject context)
 {
     base.Awake(context);
     viewModel = new MonkeysViewModel();
     // Configure interface objects here.
     Console.WriteLine("{0} awake with context", this);
 }
        void OnButtonClicked(object sender, EventArgs e)
        {
            MonkeysViewModel viewModel = BindingContext as MonkeysViewModel;
            Monkey           monkey    = viewModel.Monkeys.FirstOrDefault(m => m.Name == "Proboscis Monkey");

            collectionView.ScrollTo(monkey, position: (ScrollToPosition)enumPicker.SelectedItem, animate: animateSwitch.IsToggled);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            viewModel = new MonkeysViewModel();
            ButtonGetMonkeys.PrimaryActionTriggered += ButtonGetMonkeys_PrimaryActionTriggered;

            // Perform any additional setup after loading the view, typically from a nib.
        }
예제 #5
0
        public CustomerWishes()
        {
            InitializeComponent();
            //BindingContext = new MonkeysViewModel();
            MonkeysViewModel viewModel = new MonkeysViewModel();

            BindingContext = viewModel;

            collectionView.SelectedItems.Add(viewModel.Stores.Skip(1).FirstOrDefault());
            collectionView.SelectedItems.Add(viewModel.Stores.Skip(3).FirstOrDefault());
            collectionView.SelectedItems.Add(viewModel.Stores.Skip(4).FirstOrDefault());
        }
예제 #6
0
        public VerticalListMultiplePreSelectionPage()
        {
            InitializeComponent();

            MonkeysViewModel viewModel = new MonkeysViewModel();

            BindingContext = viewModel;

            collectionView.SelectedItems.Add(viewModel.Monkeys.Skip(1).FirstOrDefault());
            collectionView.SelectedItems.Add(viewModel.Monkeys.Skip(3).FirstOrDefault());
            collectionView.SelectedItems.Add(viewModel.Monkeys.Skip(4).FirstOrDefault());
        }
예제 #7
0
        // Commented out original Index method
        //public ActionResult Index() { return View(); }

        public ActionResult Index(MonkeysViewModel model)
        {
            // Crate new Model if parameter is null
            if (model == null)
            {
                model = new MonkeysViewModel();
            }

            // Initiate the Class & assign results to model
            var cls = new clsMonkeyBusiness();

            model.CrossingMonkeys = cls.XingMonkeys(model.LeftValue, model.RiteValue);

            return(View(model));
        }
예제 #8
0
        public static void SwitchContext(ContentPage contentPage, MonkeysViewModel monkeysVm)
        {
            var actionButton =
                contentPage.FindByName <Button>("ActionButton");

            if (contentPage.BindingContext != null)
            {
                contentPage.BindingContext = null;
                actionButton.Text          = "And now set BindingContext back";
            }
            else
            {
                contentPage.BindingContext = monkeysVm;
                actionButton.Text          = "Clear BindingContext";
            }
        }
예제 #9
0
 public MainPage()
 {
     try
     {
         InitializeComponent();
         BindingContext = new MonkeysViewModel();
         storelist      = new List <Store>();
         storelist.Add(new Store()
         {
             Id = 1, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 21.00, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 2, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 88.12, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 3, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 65.21, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 4, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 39.95, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 5, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 958.99, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 6, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 64.85, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 7, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 2050.55, Title = "Title"
         });
         storelist.Add(new Store()
         {
             Id = 8, ImageUrl = "https://cdn.shopify.com/s/files/1/1104/4168/products/Allbirds_W_Wool_Runner_Kotare_GREY_ANGLE_0f3bfe63-ac7d-4106-9acf-d26f8414ac53_600x600.png", IsLike = true, Price = 120500.00, Title = "Title"
         });
         //CV.ItemsSource = storelist;
     }
     catch (Exception ex)
     {
     }
 }
예제 #10
0
        public MonkeysPage()
        {
            Title = "Monkeys";

            var list      = new ListView();
            var viewModel = new MonkeysViewModel();

            list.ItemsSource           = viewModel.MonkeysGrouped;
            list.IsGroupingEnabled     = true;
            list.GroupDisplayBinding   = new Binding("Key");
            list.GroupShortNameBinding = new Binding("Key");
            if (Device.OS != TargetPlatform.WinPhone)
            {
                list.GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell));
            }
            list.HasUnevenRows = true; // if using a custom template for each cell you might want to enable this.

            var cell = new DataTemplate(typeof(AspectImageCell));

            cell.SetBinding(TextCell.TextProperty, "Name");
            cell.SetBinding(TextCell.DetailProperty, "Location");
            cell.SetBinding(ImageCell.ImageSourceProperty, "Image");

            list.ItemTemplate = cell;



            list.ItemTapped += (sender, args) =>
            {
                var monkey = args.Item as Monkey;
                if (monkey == null)
                {
                    return;
                }

                Navigation.PushAsync(new DetailsPage(monkey));
                // Reset the selected item
                list.SelectedItem = null;
            };

            Content = list;
        }
예제 #11
0
        public App()
        {
            var list      = new ListView();
            var viewModel = new MonkeysViewModel();

            list.ItemsSource = viewModel.Monkeys;


            var cell = new DataTemplate(typeof(MonkeyCell));

            list.RowHeight     = Device.OnPlatform(70, 70, 125);
            list.HasUnevenRows = true;
            list.ItemTemplate  = cell;


            // The root page of your application
            MainPage = new ContentPage
            {
                Title   = "Monkeys",
                Content = list
            };
        }
예제 #12
0
 public EmptyViewSwapPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
     ToggleEmptyView(false);
 }
예제 #13
0
 public HorizontalListSpacingPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
 public ScrollToByObjectPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #15
0
 public PhotosPage()
 {
     InitializeComponent();
     BindingContext = vm = new MonkeysViewModel();
 }
예제 #16
0
 public EmptyViewLoadSimulationPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #17
0
 public VerticalGridPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #18
0
 public VerticalListHeaderFooterDataTemplatePage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
 public VerticalListDynamicSizeItemsPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
 public VerticalListMultipleSelectionPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
     UpdateSelectionData(Enumerable.Empty <Monkey>(), Enumerable.Empty <Monkey>());
 }
 public EmptyViewFilteredPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #22
0
 public VerticalListDataTemplateSelectorPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #23
0
 public MyWishesView()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #24
0
 public VerticalListMultiplePreSelectionPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #25
0
 public EmptyViewTemplatePage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #26
0
 public HorizontalGridHeaderFooterViewPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #27
0
 public VerticalListSnapPointsPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
 public VerticalListSelectionColorPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
예제 #29
0
 public myPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }
 public EmptyViewDataTemplateSelectorPage()
 {
     InitializeComponent();
     BindingContext = new MonkeysViewModel();
 }