Пример #1
0
        public PropertyDescriptor MakeLookupPropertyDescriptor(AnnotationDef annotationDef, PropertyDescriptor innerPropertyDescriptor)
        {
            if (string.IsNullOrEmpty(annotationDef.Lookup))
            {
                return(innerPropertyDescriptor);
            }
            var listLookupPropertyDescriptor = new ListLookupPropertyDescriptor(this, annotationDef.Lookup, innerPropertyDescriptor);
            var listData = listLookupPropertyDescriptor.ListData;

            if (listData == null || listData.PkColumn == null)
            {
                return(innerPropertyDescriptor);
            }
            return(listLookupPropertyDescriptor);
        }
Пример #2
0
        protected override object[] GetDropdownItems()
        {
            if (ListLookupPropertyDescriptor == null)
            {
                return(null);
            }

            var items = new List <KeyValuePair <string, ListItem> >();

            items.Add(new KeyValuePair <string, ListItem>(string.Empty, null));
            var listData     = ListLookupPropertyDescriptor.GetListData();
            var listItems    = ListLookupPropertyDescriptor.GetListItems(listData).ToArray();
            var displayTexts = MakeUnambiguousNames(listData, listItems);

            for (int i = 0; i < listItems.Length; i++)
            {
                items.Add(new KeyValuePair <string, ListItem>(displayTexts[i], listItems[i]));
            }
            return(items.Cast <object>().ToArray());
        }