public override void OnBindViewHolder(FlexibleViewViewHolder holder, int position)
            {
                //Console.WriteLine($"OnBindItemView... position: {position}");
                ListItemData listItemData = mDatas[position];

                ListItemView listItemView = holder.ItemView as ListItemView;

                listItemView.Name = "Item" + position;
                //Random rd = new Random();
                listItemView.SizeWidth  = 150;
                listItemView.SizeHeight = 60;
                if (listItemView != null)
                {
                    listItemView.MainText = String.Format("{0:D2}", position) + " : " + listItemData.TextString;
                }
                listItemView.Margin = new Extents(2, 2, 2, 2);
                if (position % 2 == 0)
                {
                    listItemView.BackgroundColor = Color.Cyan;
                }
                else
                {
                    listItemView.BackgroundColor = Color.Yellow;
                }
            }
Esempio n. 2
0
                public override View GetView(int position, View convertView, ViewGroup parent)
                {
                    ListItemView returnedView = null;

                    // if 0, return the primary header view
                    if (position == 0)
                    {
                        returnedView = GetPrimaryView(convertView, parent);
                    }
                    else
                    {
                        // otherwise, see if this is an item in the 'GetEngaged' list
                        int getEngagedRowIndex = position - 1;

                        returnedView = GetStandardView(ParentFragment.GetEngagedEntries,
                                                       ParentFragment.GetEngagedBillboards,
                                                       getEngagedRowIndex,
                                                       convertView,
                                                       parent,
                                                       true);
                    }

                    // guard against not creating a row item
                    if (returnedView == null)
                    {
                        throw new NullReferenceException();
                    }
                    return(base.AddView(returnedView));
                }
Esempio n. 3
0
            public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
            {
                var listItemView = new ListItemView(parent.Context);

                listItemView.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
                return(new ViewHolder(listItemView));
            }
 public ActionResult AddNewItemList(ListItemView newList)
 {
     newList.items.Add(new ListItem {
         Id = 0, Text = "new Item"
     });
     return(View("List", newList));
 }
        public ActionResult List()
        {
            ViewBag.Message = "Your contact page.";
            ListItemView newList = new ListItemView();

            newList.items = new List <ListItem>();
            newList.items.Add(new ListItem {
                Id = 1, Text = "test"
            });
            newList.items.Add(new ListItem {
                Id = 2, Text = "test2"
            });
            return(View(newList));
        }
        public ActionResult List(ListItemView newList)
        {
            if (newList.items == null)
            {
                return(View());
            }
            ViewBag.Message = "Your contact page.";
            //List<string> myList = newList.ToList<string>();
            foreach (ListItem item in newList.items)
            {
                string i = item.Text;
            }

            return(View(newList));
        }
Esempio n. 7
0
                public override View GetView(int position, View convertView, ViewGroup parent)
                {
                    ListItemView newItem = null;

                    if (position == 0)
                    {
                        newItem = GetPrimaryView(convertView, parent);
                    }
                    else
                    {
                        newItem = GetStandardView(position - 1, convertView, parent);
                    }

                    return(AddView(newItem));
                }
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            var lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);

            if (viewType == (int)ViewType.SubHeader)
            {
                var subHeaderView = new ListSubHeaderView(Context);
                subHeaderView.LayoutParameters = lp;
                return(new ListSubHeaderViewHolder(Context, subHeaderView));
            }
            else
            {
                var listItemView = new ListItemView(Context);
                listItemView.LayoutParameters = lp;
                return(new ListItemViewHolder(Context, listItemView));
            }
        }
Esempio n. 9
0
        public int Compare(object x, object y)
        {
            ListItemView a = (ListItemView)x;
            ListItemView b = (ListItemView)y;

            if (a.DisplayOrder > b.DisplayOrder)
            {
                return(1);
            }
            if (a.DisplayOrder < b.DisplayOrder)
            {
                return(-1);
            }
            else
            {
                return(0);
            };
        }
        public static void SetListItem(this ListItemView s, IListItem listItem)
        {
            s.Title    = listItem.Title;
            s.Subtitle = listItem.Subtitle;
            s.Footer   = listItem.Footer;

            s.TitleMaxLines    = listItem.TitleMaxLines;
            s.SubtitleMaxLines = listItem.SubtitleMaxLines;
            s.FooterMaxLines   = listItem.FooterMaxLines;

            s.TitleTruncateAt    = listItem.TitleTruncateAt;
            s.SubtitleTruncateAt = listItem.SubtitleTruncateAt;
            s.FooterTruncateAt   = listItem.FooterTruncateAt;

            s.CustomView = listItem.CustomView;
            s.SetCustomViewSize(listItem.CustomViewSize);
            s.CustomAccessoryView = listItem.CustomAccessoryView;

            s.SetLayoutDensity(listItem.LayoutDensity);
        }
 public ListItemViewHolder(Context context, ListItemView view) : base(view)
 {
     Context             = context;
     listItemView        = view;
     listItemView.Click += ListItemView_Click;
 }
Esempio n. 12
0
        /// <summary>
        /// This needs to be called by the derived "GetView" so we can track the items created.
        /// </summary>
        public View AddView(ListItemView newView)
        {
            Items.Add(newView);

            return(newView);
        }