コード例 #1
0
        public CustomAndroidCellTrail(Context context, CustomCellTrail cell) : base(context)
        {
            NativeCell = cell;

            var view = (context as Activity).LayoutInflater.Inflate(Resource.Layout.CustomCellTrail_layout, null);

            NameTextView     = view.FindViewById <TextView>(Resource.Id.NameText);
            DistanceTextView = view.FindViewById <TextView>(Resource.Id.DistanceText);
            TimeTextView     = view.FindViewById <TextView>(Resource.Id.TimeText);

            AddView(view);
        }
コード例 #2
0
        public TrailSearch()
        {
            Title           = "Procurar trilhas";
            BackgroundColor = Color.White;

            Content = HelperItens.Load();

            lvSearch = new ListView
            {
                ItemTemplate = new DataTemplate(() =>
                {
                    var dtLvOpcoes = new CustomCellTrail();
                    dtLvOpcoes.SetBinding(CustomCellTrail.NameProperty, "TrailName");
                    dtLvOpcoes.SetBinding(CustomCellTrail.DistanceProperty, "DistShownd");
                    dtLvOpcoes.SetBinding(CustomCellTrail.TimeProperty, "TimeShownd");

                    return(dtLvOpcoes);
                }),
                SeparatorColor  = Color.White,
                BackgroundColor = Color.White
            };

            lvSearch.ItemSelected += (sender, e) =>
            {
                var selectedIten = (Trail)e.SelectedItem;
                if (selectedIten == null)
                {
                    return;
                }

                // Cleans the selection
                ((ListView)sender).SelectedItem = null;
            };

            sb = new SearchBar()
            {
                Placeholder   = "Digite sua pesquisa aqui",
                SearchCommand = new Command(() =>
                {
                    lvSearch.BeginRefresh();

                    trails.Sort((x, y) => x.TrailName.CompareTo(y.TrailName));
                    lvSearch.ItemsSource = trails;

                    lvSearch.EndRefresh();
                })
            };

            LoadScreen();
        }
コード例 #3
0
 public void UpdateCell(CustomCellTrail cell)
 {
     NameTextView.Text     = cell.Name;
     DistanceTextView.Text = cell.Distance;
     TimeTextView.Text     = cell.Time;
 }