[Gtk-sharp-list] Treeview question (controlling the model using a TreeModel)
Paul Bourke
pauldbourke at gmail.com
Wed Jan 2 11:56:02 EST 2008
I pasted the code badly.. maybe I can simplify my question a little as
would really like to get this working:
Basically if you check out the piece of the tutorial here:
http://www.mono-project.com/GtkSharp_TreeView_Tutorial#Controlling_how_the_model_is_used
it describes how to set up a TreeView so that it is bound to an
object containing your data. When the data in your object changes, so
does the TreeView thus allowing you to update the data easily.
My problem is that the example uses a ListModel rather than a
TreeModel as in the previous section
(http://www.mono-project.com/GtkSharp_TreeView_Tutorial#Your_first_TreeView).
If anyone has any examples of how to do this above using a TreeModel I
would greatly appreciate it.
On 31/12/2007, Michael Hutchinson <m.j.hutchinson at gmail.com> wrote:
> On Dec 30, 2007 6:01 PM, Paul Bourke <pauldbourke at gmail.com> wrote:
> ...
> > System.InvalidCastException: Cannot cast from source type to destination type.
> > at GRapid.MainWindow.RenderURLColumn (Gtk.TreeViewColumn column,
> ...
> > TreeStore myTreeStore = new TreeStore (typeof(string), typeof (MyClass));
> ...
> The two store columns have type string and MyClass,
>
> > DownloadItem d = (DownloadItem) model.GetValue (iter, 0);
>
> but you're trying to cast the string to a DownloadItem.
>
> --
> Michael Hutchinson
> http://mjhutchinson.com
>
More information about the Gtk-sharp-list
mailing list