Charlie,
Generally, you could cycle through the enumeration and add the items
manually.
If you wanted to take advantage of data binding, then I would create a
generic class like so:
public class EnumListItem<T>
{
public readonly T Value;
public readonly string Display;
public EnumListItem(T value, string display)
{
// Assign the values.
this.Value = value;
this.Display = display;
}
}
Then, you can have a method which will return an IList<EnumListItem>
implementation which you can bind your listbox to. Of course, you set your
DisplayMember to "Display" and your ValueMember to "Value".
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Charlie@CBFC" <ch*****@cbfconsulting.comwrote in message
news:uV**************@TK2MSFTNGP06.phx.gbl...
Hi:
How would I bind a list to an enumeration so that enumeration value
becomes list values and enumeration constants becomes list text? Do you
loop through enum and add manually or is there a way to databind like when
using a table as list backing store?
Thanks,
Charlie