Krzysztof's answer to a different post
(http://lists.ximian.com/pipermail/gtk-sharp-list/2011-June/010734.html) led me
to the solution. To ensure consistent display of the data in a ComboBox, I need
to add a CellRenderer. So, the code should look like this:
public CBWindow() : base("ComboBox Test")
{
store = new ListStore(typeof(string));
ComboBox cb = new ComboBox();
cb.WidthRequest = 100;
CellRendererText ct = new CellRendererText();
cb.PackStart(ct, false);
cb.AddAttribute(ct, "text", 0);
cb.Model = store;
store.AppendValues("A");
store.AppendValues("B");
store.AppendValues("C");
VBox vbox = new VBox();
vbox.Add(cb);
this.Add(vbox);
}
rather than:
>> public CBWindow() : base("ComboBox Test")
>> {
>> store = new ListStore(typeof(string));
>> store.AppendValues("A");
>> store.AppendValues("B");
>> store.AppendValues("C");
>> ComboBox cb = new ComboBox(store); // or ComboBox cb = new
>> ComboBox(); cb.Model = store;
>>
>> cb.WidthRequest = 100;
>> VBox vbox = new VBox();
>> vbox.Add(cb);
>>
>> this.Add(vbox);
>> }
>
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list