[Gtk-sharp-list] [Mono GTK#] Bind Class object to TreeView

Jay Spencer jacob.spencer80 at googlemail.com
Thu Sep 19 10:03:57 UTC 2013


Hi Alex,

Thanks for the reply.

I have read and read that tutorial over and over...

It works fine if I copy and paste it into a test project.

I just can't integrate it into my project.
I've already dragged and dropped a treeview in the designer..so surely its
already been assigned?

The treeview is on a page in a notebook widget..so its already been added
to the parent?
On 19 Sep 2013 10:38, "Alex Willmy" <alex.willmy at ekiwi.de> wrote:

> 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<http://www.mono-project.com/GtkSharp_TreeView_Tutorial>
>
> ______________________________**_________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.**com<Gtk-sharp-list at lists.ximian.com>
> http://lists.ximian.com/**mailman/listinfo/gtk-sharp-**list<http://lists.ximian.com/mailman/listinfo/gtk-sharp-list>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20130919/ceef40f3/attachment-0001.html>


More information about the Gtk-sharp-list mailing list