[Gtk-sharp-list] [Mono GTK#] Bind Class object to TreeView
Alex Willmy
alex.willmy at ekiwi.de
Thu Sep 19 09:19:38 UTC 2013
Am 18.09.2013 17:41, schrieb jaymarvels:
> I can't even make any headers appear when doing;
>
>
> teamListView = new Gtk.TreeView ();
> //add in cols
> Gtk.TreeViewColumn fNamecol = new Gtk.TreeViewColumn ();
> fNamecol.Title = "First Name";
> Gtk.TreeViewColumn sNamecol = new Gtk.TreeViewColumn ();
> fNamecol.Title = "Second Name";
>
> teamListView.AppendColumn (fNamecol);
> teamListView.AppendColumn (sNamecol);
>
> Gtk.ListStore nameListStore = new Gtk.ListStore (typeof(string),
> typeof(string));
> teamListView.Model = nameListStore;
>
>
> Its blank..nothing..i'd expect at the minimum to see 2 column headers.
You have to add the TreeView to a parent widget and then call ShowAll()
on the parent (or the top level widget). For example if the parent is an
Gtk.HBox you do it like this:
teamListView = new Gtk.TreeView ();
hbox1.Add (teamListView);
// Setting up your model and columns
hbox1.ShowAll ();
More info on TreeViews in C# can be found here:
http://www.mono-project.com/GtkSharp_TreeView_Tutorial
More information about the Gtk-sharp-list
mailing list