[Gtk-sharp-list] [Mono GTK#] Bind Object List to ComboBox

jaymarvels jacob.spencer80 at googlemail.com
Tue Sep 17 15:40:48 UTC 2013


Coming from a winform background I could do this without an issue..in gtk# I
am running into all kinds of issues.

I have something like this:

			var dataSource = new List<Positions>();
			dataSource.Add(new Positions() { positionName = "Goalkeeper",
positionMask = 1 });
			dataSource.Add(new Positions() { positionName = "Sweeper", positionMask =
2 });
			dataSource.Add(new Positions() { positionName = "Defender", positionMask
= 4 });
			dataSource.Add(new Positions() { positionName = "Defensive Mid",
positionMask = 8 });
			dataSource.Add(new Positions() { positionName = "Midfielder",
positionMask = 16 });
			dataSource.Add(new Positions() { positionName = "Attacking Mid",
positionMask = 32 });
			dataSource.Add(new Positions() { positionName = "Striker", positionMask =
64 });
			//Setup data binding for drop down
this.cboPlayerPosition.datasource = dataSource;
			this.cboPlayerPosition.DisplayMember = "positionName";
			this.cboPlayerPosition.ValueMember = "positionMask";

This failed as GTK# doesnt have .datasource ...

How can I accomplish what I am trying..

I have googled for hours trying to see how to bind a object list to a
combobox with no luck.



--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-GTK-Bind-Object-List-to-ComboBox-tp4660899.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.


More information about the Gtk-sharp-list mailing list