2

I have the following enum.

public enum DATABASE_TYPES
        {
            JDataStore, Access, SQLServer, H2, PostGresSQL, MySQL
        };

I would like to bind it to a WPF combo box.

I have tried:

cmb.ItemsSource = DATABASE_TYPES;

but get the error:

'ConfigGui.MainWindow.DATABASE_TYPES' is a 'type' but is used like a 'variable'

1 Answer 1

6

Bind it to the values of the enum:

cmb.ItemsSource = Enum.GetValues(typeof(DATABASE_TYPES)).Cast<DATABASE_TYPES>();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.