Skip Navigation LinksHome / Tips / View Tip

Tip: How to use enumeration as data source?

+ Add to SilverlightShow Favorites
1 comments   /   posted by Denislav Savkov on Aug 29, 2008
(0 votes)
Categories: Binding

Currently there is no way to do that by using binding. Instead, you can make a List<> and add the values from the enumeration in the list. Then you can use this list as data source.


List<Dock> enumDataSource = new List<Dock>() { Dock.Left, Dock.Top, Dock.Right, Dock.Bottom };
this.lbDock.ItemsSource = enumDataSource;

where lbDock is of type ListBox.

That's it!



Comments RSS RSS
  • RE: Tip: How to use enumeration as data source?  

    posted by Amr on May 25, 2009 20:11

Add Comment


Please add 3 and 2 and type the answer here:

Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)