public ListArgs(string URL, RestApi Api, string Caption, bool Searchable = false, double FontSize = 18, Thickness Margin = new Thickness(), bool Createable = false, CreateArgs Createargs = null) { url = URL; api = Api; caption = Caption; fontsize = FontSize; margin = Margin; searchable = Searchable; columns = new List <Column>(); createable = Createable; createargs = Createargs; }
/// <summary> /// 对UI进行构造。 /// </summary> /// <param name="args"></param> public void Construct(CreateArgs args) { if (args == null) { return; } this.args = args; Items.Clear(); itemlist = new object[args.items.Count]; for (int i = 0; i < args.items.Count; ++i) { var cachei = i; var thi = args.items[i]; if (thi.type == "text") { var item = new HeaderSuperText(); item.Header = thi.header; item.Editable = EditAbleStatus.Writeonly; item.ColumnWidth = thi.columnwidth ?? args.columnwidth; item.AllFontSize = thi.fontsize ?? args.fontsize; item.Margin = thi.margin ?? args.margin; itemlist[i] = item; Items.Add(item); } else if (thi.type == "choice") { var item = new HeaderSuperChoice(); item.Header = thi.header; item.Editable = EditAbleStatus.Writeonly; item.ColumnWidth = thi.columnwidth ?? args.columnwidth; item.AllFontSize = thi.fontsize ?? args.fontsize; item.Margin = thi.margin ?? args.margin; itemlist[i] = item; item.Choices = thi.data as KeyValuePair <string, string>[]; Items.Add(item); } else if (thi.type == "multi") { var item = new HeaderSuperMultiChoice(); item.Header = thi.header; item.Editable = EditAbleStatus.Writeonly; item.ColumnWidth = thi.columnwidth ?? args.columnwidth; item.AllFontSize = thi.fontsize ?? args.fontsize; item.Margin = thi.margin ?? args.margin; itemlist[i] = item; item.ItemSource = thi.data as KeyValuePair <string, string>[]; Items.Add(item); } else if (thi.type == "multitext") { var item = new HeaderSuperText(); item.Header = thi.header; item.Multiable = true; item.Editable = EditAbleStatus.Writeonly; item.ColumnWidth = thi.columnwidth ?? args.columnwidth; item.AllFontSize = thi.fontsize ?? args.fontsize; item.Margin = thi.margin ?? args.margin; itemlist[i] = item; Items.Add(item); } } }