Пример #1
0
        internal string GetItemText(object itemValue)
        {
            Debug.Assert(itemValue != null, "itemValue 为 null");

            if (itemValue == null)
            {
                return(String.Empty);
            }

            if (ItemTextGetting != null)
            {
                ShengListViewGetItemTextEventArgs args = new ShengListViewGetItemTextEventArgs(itemValue);
                ItemTextGetting(this, args);
                if (String.IsNullOrEmpty(args.Text) == false)
                {
                    return(args.Text);
                }
            }

            if (String.IsNullOrEmpty(DisplayMember))
            {
                return(itemValue.ToString());
            }
            else
            {
                return(GetItemText(itemValue, DisplayMember));
            }
        }
Пример #2
0
 void _listView_ItemTextGetting(object sender, ShengListViewGetItemTextEventArgs e)
 {
     if (this.ItemTextGetting != null)
     {
         ItemTextGettingEventArgs args = new ItemTextGettingEventArgs(e.Item);
         ItemTextGetting(this, args);
         e.Text = args.Text;
     }
 }