Avatar of OFGemini
OFGemini
 asked on

I Value converter

I need a Ivalue converter to convert enums to names.
example
instead of color = 0   color = Black And White.

using System;

namespace Dokmee_Page_Counter
{
    public enum ColorScheme
    {
        BlackAndWhite = 0,
        Grayscale = 1,
        FullColor = 2,
        ERROR = 3
    }
}

Open in new window

.NET ProgrammingMicrosoft Development

Avatar of undefined
Last Comment
OFGemini

8/22/2022 - Mon
Miguel Oz

foreach(string s in Enum.GetNames(typeof(ColorScheme )))
            Console.WriteLine(s);
    }
Miguel Oz

Jarrod


static void Main(string[] args)
{
var cs = ColorScheme.FullColor;
Console.WriteLine(cs.ToString());
}
prints "FullColor"
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
OFGemini

ASKER
good ideas all but I need an IValueConverter in WPF data binding....

ASKER CERTIFIED SOLUTION
Miguel Oz

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
OFGemini

ASKER
thanks!