[MonoDevelop] Adding A ListView To A TreeView in MonoDevelop

Nicolas Krzywinski opensource at site7even.de
Wed Nov 2 14:30:11 EDT 2011

Hello crokett,

as nobody else answered you in the meantime, I will tell you what I found  
out, starting from zero with MonoDevelop with only .NET knowledge in mind.
But be aware that I count myself to beginner level refering to mono (which  
was the reason I waited to reply...)

For what I found out, you can not assign any kind of DataStore to a  
TreeView from within the GUI. You have to do this programmatically.
To begin with a really simple TreeView layout there is a lot of steps to  
do (nearly everything from the tutorial you referenced), so it is not easy  
to "just display" something.

First, I was really angry about that complex code I had to write for a  
simple stupid list. But in the end I realized that this brings maximum  
flexibility to the TreeView.
It becomes really smart when you connect custom typed collections (or  
similar) to a TreeView, adapting the data via TreeCellDataFunc's. This  
allows you to directly display your data without converting via  
intermediate objects.

Coming back to your story, I assume you edited the designer's  
MainWindow.cs - use the normal MainWindow.cs instead where you place your  
normal code in, then the content from the tutorial will work!


Am 27.10.2011, 23:57 Uhr, schrieb crokett <crokett at gmail.com>:

> I am learning MonoDevelop and C# as I go.  I am trying to add the  
> functional
> equivalent of a listbox to the main window of my app.  I don't see a  
> listbox
> widget but found this tutorial which explains how to create a list view
> using a treeview:
> http://www.mono-project.com/GtkSharp_TreeView_Tutorial
> My issue is the properties under the GUI designer don't allow me to add a
> ListStore or a TreeViewColumn to the Treeview, nor can I set the model.   
> If
> I edit the MainWindow.cs file directly, those changes get wiped out on  
> the
> next build.  How can I make the changes so they are persistent and I get  
> the
> columns I want in the treeview?  Or is there a way to do this through the
> GUI?
> --
> View this message in context:  
> http://mono.1490590.n4.nabble.com/Adding-A-ListView-To-A-TreeView-in-MonoDevelop-tp3946168p3946168.html
> Sent from the Mono - MonoDevelop IDE mailing list archive at Nabble.com.
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list

www.site7even.de | www.nskcomputing.de

More information about the Monodevelop-list mailing list