Frage

I am using MonoDevelop to create a GUI but it doesn't contain a ListBox conrol. I read that Tree View is a good alternative so I'm trying to get it to work, but nothing appears to be added to the Tree View at all.

ListStore _store;

public MainWindow (): base (Gtk.WindowType.Toplevel)
{
    Build ();

    _store = new Gtk.ListStore (typeof(string));
    lbErrors.Model = _store; // lbErrors is the Tree View

    Error("err");
}

public void Error(string err)
{
    var ii = _store.Append();
    _store.SetValues(ii, err);
}

Can anyone spot the problem?

War es hilfreich?

Lösung

You need to set your table columns.

Try something like this:

var column = new TreeViewColumn ();
column.Title = "Column Name";
column.Clickable = false;

var renderer = new CellRendererText ();
column.PackStart (renderer, true);

column.AddAttribute (renderer, "text", 0);
lbErrors.AppendColumn (column);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top