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 7840221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:42:23+00:00 2026-06-02T15:42:23+00:00

I am writing a WPF application and I would like to use an Enum

  • 0

I am writing a WPF application and I would like to use an Enum for a State variable.

Example: When the program start up certain controls are disabled until the state changes.

When the state changes I would like to disable/enable a variety of controls via an event handler. I have written plenty of custom event handlers in the past, however, using an enum as the trigger has managed to blow my mind.

Any suggestions?

  • 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-02T15:42:25+00:00Added an answer on June 2, 2026 at 3:42 pm

    If you’re using an MVVM approach then I agree with Daniel White that you need to implement INotifyPropertyChanged. You should bind the IsEnabled member on your controls to a property on your ViewModel.

    Code:

    public class ViewModel : INotifyPropertyChanged
    {
          public MyEnum EnumValue 
          { 
               get { return enumValue; } 
               set { 
                     enumValue = value;
                     AreControlsEnabled = enumValue == MyEnum.SomeValue;
               }
          }
    
          public bool AreControlsEnabled 
          {
               get { return areControlsEnabled; }
               set {
                     areControlsEnabled = value;
                     if (PropertyChanged != null)
                         PropertyChanged(this, new PropertyChangedEventArg("AreControlsEnabled");
                }
          }
    
          public event PropertyChangedEventHandler PropertyChanged;
    }
    

    XAML:

    <TextBox IsEnabled="{Binding AreControlsEnabled}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a wpf destop application, and would like to use SQL Server
I'm writing an application in WPF using the MVVM-pattern and will really often use
i'm thinking about writing a WPF program that would require login and password at
I'm writing a program in WPF application that simulates the game of life. How
When writing a WPF application using MVVM, I want to use a WCF service,
I am writing a WPF application and I want to use Data Annotations to
Im writing a WPF application that has a zoom and pan ability, but what
I'm writing a WPF application with C# as the code behind and I want
I am writing a WPF application on WinXP and I have overridden the default
I'm writing a WPF application and trying to bind an image to my view

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.