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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:41:33+00:00 2026-06-03T11:41:33+00:00

I have two buttons in my application Now I want to bind the btnOff

  • 0

I have two buttons in my application

Now I want to bind the btnOff to !isOn. Meaning is btnOn is Enabled, btnOff should be Disabled and vice-versa

EDIT: Below is my implementation:

<Button x:Name="btnOn" Content="On" Width="45" Height="24" IsEnabled="{Binding isOn, Converter={StaticResource BoolInverter}}" />
   <Button x:Name="btnOff" Content="Off" Width="45" Height="24" IsEnabled="{Binding isOn} />

 public class BoolInverterConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }
            return value;
        }

    }
  • 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-03T11:41:34+00:00Added an answer on June 3, 2026 at 11:41 am

    Wouldn’t it be simpler to have another computed/derived property IsOff (no backing field) that negates the IsOn property ?

    public bool IsOn{ 
      get{...}
      set
      {    _isOn = value; 
           NotifyPropertyChanged("IsOn");
           NotifyPropertyChanged("IsOff");
      }
    }
    
    public bool IsOff
    {
       get{   return !IsOn;}
    }
    

    Converters are normally used to convert data types e.g. to bind a Visibility enum property to a boolean backing property in the viewmodel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
In Application i have two buttons in which one button is used as a
Application, have a TextBlock and two Buttons, the text is displayed TextBlock by clicking
In my application screen, i have two buttons. one is Activate and another is
I have developed an Android application targeting Android 2.2 now I want to make
I have created two java class with UIBinder in GWT application. I want to
i have two submit buttons on my mvc application. 1. <input type=submit class=btnsubmit value=Add
I have two buttons that moves a movieclip up/down the Y-axis. How do I
I have two buttons, one for start recording and another for stop recording. i
I have two buttons, which the user can click and will open a FileDiagloag

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.