[Gtk-sharp-list] Having trouble getting IconView to work

countcb count.cb at gmx.net
Thu Jul 17 03:41:37 EDT 2008



vbtricks wrote:
> 
> Salut,
> 
> I am trying to initialize an IconView. In the MonoDevelop designer I added
> the IconView iconView1 to the window and did not modify any properties. In
> the code-behind file in the constructor I'm trying to initialize the
> ListStore:
> 
> private Gtk.ListStore store;
> 
> public MainWindow(): base(Gtk.WindowType.Toplevel)
> {
>   Build();
>   
>   this.store = new ListStore(typeof(string), typeof(string),
> typeof(string));
>   this.store.AppendValues("1", "2", "3");
>   this.iconview1.Model = this.store;
> }
> 
> though, the IconView does not display anything. How to get a three
> columned IconView to work?
> 
> 
> Thanks in advance,
> 
> Stefan
> 

At First: IconView is used to Display Icons (Images). So your model
(ListStore) should contain some Images.

  this.store = new ListStore(typeof(string), typeof (Gdk.Pixbuf),
typeof(string));
  // append some values here


Then you have to tell the IconView in which colums of your model it can find
the needed information.
MarkupColumn	int. Contains the number of the model column containing markup
information to be displayed.
PixbufColumn	int. Contains the number of the model column containing the
pixbufs which are displayed

For Example:
this.iconview1.MarkupColumn = 0; // the info string
this.iconview1.PixbufColumn = 1; // this has to the column with the
Gdk.Pixbuf

Then your iconview should display the string in column 0 as an info, and the
Pixbuf in Column 1 as the Icon.

Hope that helps.

-- 
View this message in context: http://www.nabble.com/Having-trouble-getting-IconView-to-work-tp18489782p18503235.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list