Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8115009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:19:38+00:00 2026-06-06T03:19:38+00:00

I need to display all enum values as tab items on TabControl, except one

  • 0

I need to display all enum values as tab items on TabControl, except one enum member (None)

enum MyEnum { Value1, Value2, Value3, None }

TabControl should display three tabs (Value1, Value2 and Value3). I need to be able to get/set current tab in the ViewModel by binding to SelectedItem property. Header for each tab uses localized enum value, which currently I do using converter.

Is this possible? I have tried many things, but could not make it work. I have no trouble with manually adding each TabItem, but I am unsure how to make SelectedItem (tab) to be of enum type.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:19:39+00:00Added an answer on June 6, 2026 at 3:19 am

    I found the solution. Normally you would do this in order to get a list of enum members:

    <ObjectDataProvider x:Key="SomeEnumValues"
                        MethodName="GetValues" 
                        ObjectType="{x:Type sys:Enum}">
        <ObjectDataProvider.MethodParameters>
            <x:Type TypeName="vm:SomeEnum" />
        </ObjectDataProvider.MethodParameters>
    </ObjectDataProvider>
    

    This would get all the members, so its not a way to go. I have created a custom converter that will accept enum value, and extract all members from type

    // in the convert method
    Type type = value.GetType();
    
    List<object> enumValues = new List<object>();
    
    // add each member, except None (has value of 0)
    foreach (var field in type.GetFields())
    {
        if (field.IsLiteral)
        {
            var x = field.GetValue(null);
    
            // add new value
            if ((int)x != 0)
                enumValues.Add(field.GetValue(null));
        }
    }
    

    Localization is done in the ItemTemplate. In there I also use converter (different one), where I get the localized value.

    <DataTemplate x:Key="EnumItemTemplate">
        <TextBlock Text="{Binding Mode=OneWay, Converter={StaticResource enumConverter}}"/>
    </DataTemplate>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display all values of an enum as <option> elements. I have
In one of my applications, I need to display all the wi-fi and Bluetooth
i need to display all the photos as thumbnails in one window from my
I need to display all the pages on the one page. At the moment
I need to display all the employees in one webpart. I created the gridview
i am developing one application with map view i need display the weather depends
I need to display a menu in Joomla and remove 2 items from it.
I need to display all tables that have zero records. I tried, select *
I need to display all my post titles in the sidebar of my Wordpress
I'm looking at making a booking system and I need to display all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.