Example #1
0
 void FillListViewItem(ListViewItem lvItem, int index)
 {
     if (index >= 0 && this._data != null && index < this._data.Count)
     {
         object item = this._data[index];
         for (int i = 0; i < lvItem.SubItems.Count; ++i)
         {
             ColumnBinding header  = this.Columns[i] as ColumnBinding;
             var           subItem = lvItem.SubItems[i];
             if (header != null)
             {
                 object value = header.GetPropertyValue(item);
                 if (value != null)
                 {
                     subItem.Text = value.ToString();
                 }
             }
         }
     }
 }
Example #2
0
 private void BindingListView_QueryItemText(int item, int subItem, out string text)
 {
     text = string.Empty;
     try
     {
         if (_QueryItemText != null)
         {
             _QueryItemText(item, subItem, out text);
         }
         else if (DataSource != null && item < DataSource.Count)
         {
             ColumnBinding header = this.Columns[subItem] as ColumnBinding;
             if (header != null)
             {
                 object value = header.GetPropertyValue(DataSource[item]);
                 if (value != null)
                 {
                     text = value.ToString();
                 }
             }
         }
     }
     catch {}
 }