(X) Hide this
    • Login
    • Join
      • Say No Bots Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

Tip: How to use enumeration as data source?

(0 votes)
Denislav Savkov
>
Denislav Savkov
Joined Feb 11, 2008
Articles:   14
Comments:   6
More Articles
1 comments   /   posted on Aug 29, 2008
Categories:   Data 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.

C#

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!


Subscribe

Comments

Add Comment

Login to comment:
  *      *       
Login with Facebook