1

I want to get the Enum values into a DropDown list (WPF Binding), but the values should include characters like Spaces and Forward-Slashes which is not allowed in Enum Values, I guess there is a way to get a modified value binding or set an Attribute to each value,

This is my Enum:

public enum CurrencyPair
{ 
    JPY_EUR = 1,
    USD_NZD = 2,
    EUR_AUD = 3,
}

It's definitely different than the duplicate-marked question, because yes I found the answer there, but my question was in a position that I don't know how to search for it - since I didn't know what Attribute is needed for this purpose...

Mayer Spitz
  • 2,577
  • 1
  • 20
  • 26
  • Here's [a possible answer](https://stackoverflow.com/a/25109103) – Maximilian Burszley Nov 01 '17 at 16:57
  • I don't understand why this is a duplicate question, as this question refers to ask if there is and what is the Attribute needed for that, and the other question asks about binding it to WPF when you have it already. the only answer on this question was helpful, Thanks! – Mayer Spitz Nov 01 '17 at 22:22

1 Answers1

1

You'll want to use the Description attribute from System.ComponentModel.DataAnnotations

The answers to this question have the code you need:

Enum ToString with user friendly strings

IJBurgess
  • 92
  • 1
  • 1
  • 6