public static Gtk.TreeView RemoveColumns(Gtk.TreeView tv) { Gtk.TreeViewColumn [] myColumns = tv.Columns; foreach (Gtk.TreeViewColumn column in myColumns) { tv.RemoveColumn (column); } return tv; }
public static void PrepareFileTxtView(Gtk.TreeView tvTable) { try { Gtk.ListStore listStore = new Gtk.ListStore( new System.Type[]{ typeof(string) } ); tvTable.Model = listStore; // Delete existing columns while( tvTable.Columns.Length > 0 ) { tvTable.RemoveColumn( tvTable.Columns[ 0 ] ); } // Create data column var column = new Gtk.TreeViewColumn(); var cell = new Gtk.CellRendererText(); column.Title = "txt"; column.PackStart( cell, true ); cell.Editable = false; cell.Foreground = "black"; cell.Background = "white"; column.AddAttribute( cell, "text", 0 ); tvTable.AppendColumn( column ); } catch(Exception e) { Util.MsgError( null, Core.AppInfo.Name, "Error building view: '" + e.Message + '\'' ); } tvTable.EnableGridLines = TreeViewGridLines.Horizontal; tvTable.SetCursor( new TreePath( new int[]{ 0 } ), tvTable.Columns[ 0 ], false ); tvTable.Show(); }