public GroupedListCode ()
		{
			var lstView = new ListView ();
			grouped = new ObservableCollection<GroupedVeggieModel> ();
			var veggieGroup = new GroupedVeggieModel () { LongName = "vegetables", ShortName="v" };
			var fruitGroup = new GroupedVeggieModel () { LongName = "fruit", ShortName = "f" };
			veggieGroup.Add (new VeggieModel () { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
			veggieGroup.Add (new VeggieModel () { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
			veggieGroup.Add (new VeggieModel () { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
			veggieGroup.Add (new VeggieModel () { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
			fruitGroup.Add (new VeggieModel () {Name = "banana", IsReallyAVeggie = false,Comment = "available in chip form factor"});
			fruitGroup.Add (new VeggieModel () {Name = "strawberry", IsReallyAVeggie = false,Comment = "spring plant"});
			fruitGroup.Add (new VeggieModel () {Name = "cherry", IsReallyAVeggie = false,Comment = "topper for icecream"});

			grouped.Add (veggieGroup); 
			grouped.Add (fruitGroup);

			lstView.ItemsSource = grouped;
			lstView.IsGroupingEnabled = true;
			lstView.GroupDisplayBinding = new Binding ("LongName");
			lstView.GroupShortNameBinding = new Binding ("ShortName");

			lstView.ItemTemplate = new DataTemplate (typeof(TextCell));
			lstView.ItemTemplate.SetBinding (TextCell.TextProperty, "Name");
//			lstView.ItemTemplate.SetBinding (TextCell.DetailProperty, "Comment");
			Content = lstView;
		}
Ejemplo n.º 2
0
        public GroupedListCode()
        {
            var lstView = new ListView();

            grouped = new ObservableCollection <GroupedVeggieModel> ();
            var veggieGroup = new GroupedVeggieModel()
            {
                LongName = "vegetables", ShortName = "v"
            };
            var fruitGroup = new GroupedVeggieModel()
            {
                LongName = "fruit", ShortName = "f"
            };

            veggieGroup.Add(new VeggieModel()
            {
                Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream"
            });

            grouped.Add(veggieGroup);
            grouped.Add(fruitGroup);

            lstView.ItemsSource           = grouped;
            lstView.IsGroupingEnabled     = true;
            lstView.GroupDisplayBinding   = new Binding("LongName");
            lstView.GroupShortNameBinding = new Binding("ShortName");

            lstView.ItemTemplate = new DataTemplate(typeof(TextCell));
            lstView.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");
            //			lstView.ItemTemplate.SetBinding (TextCell.DetailProperty, "Comment");
            Content = lstView;
        }
Ejemplo n.º 3
0
        static ObservableCollection <GroupedVeggieModel> CreateData()
        {
            var grouped = new ObservableCollection <GroupedVeggieModel>();

            var veggieGroup = new GroupedVeggieModel()
            {
                LongName = "vegetables", ShortName = "v"
            };

            veggieGroup.Add(new VeggieModel()
            {
                Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod"
            });

            var fruitGroup = new GroupedVeggieModel()
            {
                LongName = "fruit", ShortName = "f"
            };

            fruitGroup.Add(new VeggieModel()
            {
                Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream"
            });

            grouped.Add(veggieGroup);
            grouped.Add(fruitGroup);

            return(grouped);
        }
 public GroupedListXaml()
 {
     InitializeComponent ();
     grouped = new ObservableCollection<GroupedVeggieModel> ();
     var veggieGroup = new GroupedVeggieModel () { LongName = "vegetables", ShortName="v" };
     var fruitGroup = new GroupedVeggieModel () { LongName = "fruit", ShortName = "f" };
     veggieGroup.Add (new VeggieModel () { Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log" });
     veggieGroup.Add (new VeggieModel () { Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil" });
     veggieGroup.Add (new VeggieModel () { Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread" });
     veggieGroup.Add (new VeggieModel () { Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod" });
     fruitGroup.Add (new VeggieModel () {Name = "banana", IsReallyAVeggie = false,Comment = "available in chip form factor"});
     fruitGroup.Add (new VeggieModel () {Name = "strawberry", IsReallyAVeggie = false,Comment = "spring plant"});
     fruitGroup.Add (new VeggieModel () {Name = "cherry", IsReallyAVeggie = false,Comment = "topper for icecream"});
     grouped.Add (veggieGroup); grouped.Add (fruitGroup);
     lstView.ItemsSource = grouped;
 }
Ejemplo n.º 5
0
        public GroupedListXaml()
        {
            InitializeComponent();
            grouped = new ObservableCollection <GroupedVeggieModel> ();
            var veggieGroup = new GroupedVeggieModel()
            {
                LongName = "vegetables", ShortName = "v"
            };
            var fruitGroup = new GroupedVeggieModel()
            {
                LongName = "fruit", ShortName = "f"
            };

            veggieGroup.Add(new VeggieModel()
            {
                Name = "celery", IsReallyAVeggie = true, Comment = "try ants on a log"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "tomato", IsReallyAVeggie = false, Comment = "pairs well with basil"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "zucchini", IsReallyAVeggie = true, Comment = "zucchini bread > bannana bread"
            });
            veggieGroup.Add(new VeggieModel()
            {
                Name = "peas", IsReallyAVeggie = true, Comment = "like peas in a pod"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "banana", IsReallyAVeggie = false, Comment = "available in chip form factor"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "strawberry", IsReallyAVeggie = false, Comment = "spring plant"
            });
            fruitGroup.Add(new VeggieModel()
            {
                Name = "cherry", IsReallyAVeggie = false, Comment = "topper for icecream"
            });
            grouped.Add(veggieGroup); grouped.Add(fruitGroup);
            lstView.ItemsSource = grouped;
        }
Ejemplo n.º 6
0
        public PageTramVTGanDayViewModel(ListView listViewTramVtGanDay)
        {
            grouped = new ObservableCollection <GroupedVeggieModel>();

            _listViewTramVtGanDay = listViewTramVtGanDay;
            //_listViewTramVtGanDay.ItemsSource = _tramVtGanDay;
            _listViewTramVtGanDay.ItemsSource = grouped;
            _listViewTramVtGanDay.ItemTapped += ListViewTramVtGanDayOnItemTapped;


            foreach (var intemofTramVienThong in Initial.dataGetTramVienThong)
            {
                var groupName = new GroupedVeggieModel()
                {
                    LongName = intemofTramVienThong.TramVTNAME, ShortName = "z"
                };
                foreach (var item in intemofTramVienThong.DanhSachKetCuoi)
                {
                    string tempSplitter = "";
                    string tempFType    = "";
                    if (item.SPLITTER != "")
                    {
                        tempSplitter = "(" + item.SPLITTER + ") ";
                    }
                    tempFType = item.FType == "0" ? "copper50x50.jpg" : "fiber50x50.jpg";
                    groupName.Add(new DanhSachKetCuoi()
                    {
                        CABI_NAME   = item.CABI_NAME,                                                         //1A
                        KC          = tempSplitter + item.KC + " mét",                                        //1B
                        CABI_ADDR   = item.CABI_ADDR,
                        DungLuong   = item.DungLuong,                                                         //2B
                        DLCapDen    = intemofTramVienThong.TramVTNAME + " Cáp đến:" + item.DLCapDen + " đôi", //3A
                        SoThueBao   = item.SoThueBao + " tb",                                                 //3B
                        FType       = tempFType,
                        HoTen       = item.HoTen,
                        SoDienThoai = item.SoDienThoai
                    });
                }
                grouped.Add(groupName);
            }
        }