GetModelObject() public method

Return the model object at the given index
public GetModelObject ( int index ) : object
index int Index of the model object to be returned
return object
        private static string RowToString(ObjectListView listView, int rowIndex, string[] values)
        {
            var columns = listView.ColumnsInDisplayOrder;
            int nbCol = columns.Count;

            var modelObject = listView.GetModelObject(rowIndex);
            for (int i = 0; i < nbCol; i++)
            {
                var col = columns[i];
                string val = col.GetStringValue(modelObject);
                string escapeVal = StringHelpers.Escape(val);
                values[i] = escapeVal;
            }
            return string.Join("\t", values);
        }
Beispiel #2
0
        public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column) {
            this.DropDownStyle = ComboBoxStyle.DropDown;

            Dictionary<String, bool> alreadySeen = new Dictionary<string, bool>();
            for (int i = 0; i < Math.Min(lv.GetItemCount(), 1000); i++) {
                String str = column.GetStringValue(lv.GetModelObject(i));
                if (!alreadySeen.ContainsKey(str)) {
                    this.Items.Add(str);
                    alreadySeen[str] = true;
                }
            }

            this.Sorted = true;
            this.AutoCompleteSource = AutoCompleteSource.ListItems;
            this.AutoCompleteMode = AutoCompleteMode.Append;
        }
        /// <summary>
        /// Create an AutoCompleteCellEditor
        /// </summary>
        /// <param name="lv"></param>
        /// <param name="column"></param>
        public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column)
        {
            this.DropDownStyle = ComboBoxStyle.DropDown;

            Dictionary<String, bool> alreadySeen = new Dictionary<string, bool>();
            for (int i = 0; i < Math.Min(lv.GetItemCount(), 1000); i++) {
                String str = column.GetStringValue(lv.GetModelObject(i));
                if (!alreadySeen.ContainsKey(str)) {
                    this.Items.Add(str);
                    alreadySeen[str] = true;
                }
            }

            this.Sorted = true;
            this.AutoCompleteSource = AutoCompleteSource.ListItems;
            this.AutoCompleteMode = AutoCompleteMode.Append;
        }
        public AutoCompleteCellEditor(ObjectListView lv, OLVColumn column)
        {
            base.DropDownStyle = ComboBoxStyle.DropDown;
            Dictionary <string, bool> dictionary = new Dictionary <string, bool>();

            for (int i = 0; i < Math.Min(lv.GetItemCount(), 0x3e8); i++)
            {
                string stringValue = column.GetStringValue(lv.GetModelObject(i));
                if (!dictionary.ContainsKey(stringValue))
                {
                    base.Items.Add(stringValue);
                    dictionary[stringValue] = true;
                }
            }
            base.Sorted             = true;
            base.AutoCompleteSource = AutoCompleteSource.ListItems;
            base.AutoCompleteMode   = AutoCompleteMode.Append;
        }
 /// <summary>
 /// Return the model object at the given index
 /// </summary>
 /// <param name="index">The index of the model object</param>
 /// <returns>The model object or null</returns>
 public virtual T GetModelObject(int index)
 {
     return((T)olv.GetModelObject(index));
 }