Esempio n. 1
0
        public PlacesListView()
        {
            InitializeComponent();
            _binding = new PlacesListViewModel(this);
            _binding.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Places")
                {
                    if (_binding.Places == null)
                    {
                        return;
                    }

                    lsPlaces.HasUnevenRows  = true;
                    lsPlaces.ItemTemplate   = new DataTemplate(typeof(PlaceCell));
                    lsPlaces.ItemsSource    = _binding.Places;
                    lsPlaces.SeparatorColor = Color.FromHex("#ddd");
                    lsPlaces.IsRefreshing   = false;
                }
            };

            lsPlaces.ItemTapped += async(sender, args) =>
            {
                await _binding.OpenPlaceAsync((PlaceModel)args.Item);

                lsPlaces.SelectedItem = null;
            };

            lsPlaces.BackgroundColor = Color.Transparent;

            BindingContext = _binding;
            GetPlaces();
        }
 public PlaceListViewPage()
 {
     InitializeComponent();
     BindingContext = new PlacesListViewModel()
     {
         Navigation = this.Navigation
     };
 }
 public PlacesListPage()
 {
     InitializeComponent();
     BindingContext = new PlacesListViewModel();
 }