public static ctrl_TableList set_ColumnWidth(this ctrl_TableList tableList, int columnNumber, int width) { return((ctrl_TableList)tableList.invokeOnThread( () => { var listView = tableList.getListViewControl(); //if (listView.Columns.size()>columnNumber) tableList.getListViewControl().Columns[columnNumber].Width = width; return tableList; })); }
//TO MAP to groups above public static ctrl_TableList setWidthToContent(this ctrl_TableList tableList) { tableList.makeColumnWidthMatchCellWidth(); tableList.Resize += (e, s) => { tableList.makeColumnWidthMatchCellWidth(); }; tableList.getListViewControl().ColumnClick += (e, s) => { tableList.makeColumnWidthMatchCellWidth(); }; return(tableList); }
public static ctrl_TableList clearTable(this ctrl_TableList tableList) { var listViewControl = tableList.getListViewControl(); listViewControl.invokeOnThread(() => listViewControl.Clear()); return(tableList); }
public static ctrl_TableList clearRows(this ctrl_TableList tableList) { return((ctrl_TableList)tableList.invokeOnThread( () => { tableList.getListViewControl().Items.Clear(); return tableList; })); }
//events public static ctrl_TableList afterSelect(this ctrl_TableList tableList, Action <List <ListViewItem> > callback) { tableList.getListViewControl().SelectedIndexChanged += (sender, e) => { if (callback.notNull()) { var selectedItems = new List <ListViewItem>(); foreach (ListViewItem item in tableList.getListViewControl().SelectedItems) { selectedItems.Add(item); } callback(selectedItems); } }; return(tableList); }
public static ctrl_TableList add_Column(this ctrl_TableList tableList, string columnName) { var listViewControl = tableList.getListViewControl(); listViewControl.invokeOnThread(() => listViewControl.Columns.Add(columnName)); return(tableList); }
public static ctrl_TableList selectFirst(this ctrl_TableList tableList) { return((ctrl_TableList)tableList.invokeOnThread( () => { var listView = tableList.getListViewControl(); listView.SelectedIndices.Clear(); listView.SelectedIndices.Add(0); return tableList; })); }
public static ctrl_TableList set_ColumnAutoSizeForLastColumn(this ctrl_TableList tableList) { return((ctrl_TableList)tableList.invokeOnThread( () => { var listView = tableList.getListViewControl(); if (listView.Columns.size() > 0) { listView.Columns[listView.Columns.size() - 1].Width = -2; } return tableList; })); }
// ListViewItem public static List <ListViewItem> items(this ctrl_TableList tableList) { return((List <ListViewItem>)tableList.invokeOnThread( () => { var items = new List <ListViewItem>(); foreach (ListViewItem item in tableList.getListViewControl().Items) { items.Add(item); } return items; })); }
//Column(s) public static ctrl_TableList add_Columns(this ctrl_TableList tableList, List <string> columnNames) { return((ctrl_TableList)tableList.invokeOnThread( () => { ListView listView = tableList.getListViewControl(); listView.Columns.Clear(); listView.AllowColumnReorder = true; foreach (var columnName in columnNames) { listView.Columns.Add(columnName); } return tableList; })); }
public static ListViewItem add_ListViewItem(this ctrl_TableList tableList, List <string> rowData) { return((ListViewItem)tableList.invokeOnThread( () => { var listView = tableList.getListViewControl(); var listViewItem = new ListViewItem(); if (rowData.Count > 0) { listViewItem.Text = rowData[0]; // hack because SubItems starts adding on the 2nd Column :( rowData.RemoveAt(0); listViewItem.SubItems.AddRange(rowData.ToArray()); listView.Items.Add(listViewItem); } return listViewItem; })); }
public static ctrl_TableList set_ColumnsWidth(this ctrl_TableList tableList, bool lastColumnShouldAutoSize, params int[] widths) { return((ctrl_TableList)tableList.invokeOnThread( () => { var listView = tableList.getListViewControl(); for (var i = 0; i < widths.Length; i++) { listView.Columns[i].Width = widths[i]; } if (lastColumnShouldAutoSize) { tableList.set_ColumnAutoSizeForLastColumn(); } return tableList.set_ColumnAutoSizeForLastColumn(); })); }
//very similar to the code in add_Row (prob with that one is that it doens't return the new ListViewItem object public static ctrl_TableList add_Row <T>(this ctrl_TableList tableList, T _objectToAdd, Func <List <string> > getRowData) { return((ctrl_TableList)tableList.invokeOnThread( () => { var rowData = getRowData(); if (rowData.Count > 0) { var listView = tableList.getListViewControl(); var listViewItem = new ListViewItem(); listViewItem.Text = rowData[0]; // hack because SubItems starts adding on the 2nd Column :( rowData.RemoveAt(0); listViewItem.SubItems.AddRange(rowData.ToArray()); listView.Items.Add(listViewItem); listViewItem.Tag = _objectToAdd; // only difference with main add_Row } return tableList; })); }
public static ListView listView(this ctrl_TableList tableList) { return(tableList.getListViewControl()); }