private void InitTypeData() { if (usertype == null || usertype.options == null) { return; } if (usertype != null && usertype.options != null) { usertype.options.Clear(); } DropDownDataItem optiondata = null; DropDownItem playerItem = new DropDownItem(0, "玩家"); DropDownItem adminItem = new DropDownItem(1, "管理员"); DropDownItem propItem = new DropDownItem(2, "道具"); DropDownItems.Add(playerItem); DropDownItems.Add(adminItem); DropDownItems.Add(propItem); foreach (DropDownItem item in DropDownItems) { optiondata = new DropDownDataItem(); optiondata.id = item.id; optiondata.text = item.name; usertype.options.Add(optiondata); } usertype.value = -1; }
public void InsertData(int position, DropDownDataItem data) { if (position == -1) { position = itemDataList.Count; } itemDataList.Insert(position, data); AdapterPurge = true; }
private void CreateList() { RestFulProxy.GetRoomListByAdmin(LoginInfo.Userinfo.id, (result) => { List <Room> roomList = Utils.CollectionsConvert.ToObject <List <Room> >(result); if (dropList == null || dropList.options == null) { return; } ClearData(); this.roomList = roomList; DropDownDataItem optiondata = new DropDownDataItem(); optiondata.id = -1; optiondata.text = "请选择战队"; dropList.options.Add(optiondata); roomList.ForEach((room) => { optiondata = new DropDownDataItem(); optiondata.id = room.id; optiondata.text = room.name; dropList.options.Add(optiondata); }); dropList.value = -1; }); }
public void BindViewHolder(ViewHolder holder, int position) { if (null == holder) { return; } DropDownDataItem listItemData = itemDataList[position]; if (listItemData == null) { return; } DropDownItemView listItemView = holder.ItemView as DropDownItemView; if (listItemView == null) { return; } listItemView.Name = "Item" + position; if (listItemData.Size != null) { if (listItemData.Size.Width > 0) { holder.ItemView.WidthSpecification = (int)listItemData.Size.Width; } else { holder.ItemView.WidthSpecification = LayoutParamPolicies.MatchParent; } if (listItemData.Size.Height > 0) { holder.ItemView.HeightSpecification = (int)listItemData.Size.Height; } else { holder.ItemView.HeightSpecification = LayoutParamPolicies.MatchParent; } } if (listItemView != null) { listItemView.BackgroundColorSelector = listItemData.BackgroundColor; if (listItemData.Text != null) { listItemView.Text = listItemData.Text; listItemView.PointSize = listItemData.PointSize; listItemView.FontFamily = listItemData.FontFamily; listItemView.TextPosition = listItemData.TextPosition; } if (listItemData.IconResourceUrl != null) { listItemView.IconResourceUrl = listItemData.IconResourceUrl; listItemView.IconSize = listItemData.IconSize; if (listItemView.IconSize != null) { listItemView.IconPosition = new Position(listItemData.IconPosition.X, (listItemView.Size2D.Height - listItemView.IconSize.Height) / 2); } } if (listItemData.CheckImageResourceUrl != null) { listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl; if (null != listItemData.CheckImageSize) { listItemView.CheckImageSize = listItemData.CheckImageSize; } if (listItemView.CheckImageSize != null) { listItemView.CheckPosition = new Position(listItemView.Size2D.Width - listItemData.CheckImageGapToBoundary - listItemView.CheckImageSize.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize.Height) / 2); } } listItemView.IsSelected = listItemData.IsSelected; } }