I have a Silverlight (WP7) project and would like to bind an enum to a listbox. This is an enum with custom values, sitting in a class library. How do I do this?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Convert the enum to a list (or similar) - as per How do I convert an enum to a list in C#?
then bind to the converted list.
Use a converter to do this. Refer to http://geekswithblogs.net/cskardon/archive/2008/10/16/databinding-an-enum-in-wpf.aspx.
In Silverlight(WP7), Enum.GetNames() method is not available. You can use the following
The static method will returns enumerable string collection. You can bind that to a listbox's itemssource. Like