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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:36:03+00:00 2026-05-25T20:36:03+00:00

I am developing a simple exercise and want to know if there is a

  • 0

I am developing a simple exercise and want to know if there is a way to bind to the opposite of another element using only XAML. For example. I have two buttons on a form, Start and Stop perhaps for a timer. I dont want both to be enables at the same time. When the program starts, the stop button should be disabled. When the start button is clicked, it should be disabled and the stop button enabled. Then vice versa until the user quits.

I know there are better controls for exactly this, and I know it is easy to do in code. I just wanted to know if there is some sort of NOT operator in XAML that could look like this:

<Button Content="_Start" Name="btnStart"/>
<Button Content="_Stop" Name="btnStop"
        IsEnabled="{Binding ElementName=btnStart,
                    Path=Not(IsEnabled)}"/>

Or something like:

                    Path != IsEnabled}"/>

Or even something like:

                    Path=IsEnabled.Not()}"/>

I know I can bind directly to the start button, but when one is enabled so is the other, and likewise when it is disabled. See where I am comming from.

I would be even willing to entertain some sort of XAML Validation thehnique which will first check the state of the start button and force the state of the stop one to be the opposite. Or any other similar hacks or workarounds that dont require codebehind.

Thanks for any help on this.

EDITS:
Remember the key point for this is NO code behind. If I have to write a single line of code behind I might as well just use the onclick event handler and a simple ?: operator. So I want only something that will work directly in XAML.

  • 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-05-25T20:36:04+00:00Added an answer on May 25, 2026 at 8:36 pm

    There isn’t a Not operation out of the box. However, it’s pretty easy to achieve this yourself using a custom converter:

    public class NotConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return !(bool) value;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return !(bool)value;
        }
    }
    

    Then you can specify it as a converter on your binding.

    <Button Content="_Stop" Name="btnStop"
        IsEnabled="{Binding ElementName=btnStart, Converter={StaticResource NotConverter} Path=IsEnabled}"/>
    

    And finally create a resource on your Window / Page called NotConverter:

    <Window.Resources>
        <ns:NotConverter x:Key="NotConverter" />
    </Window.Resources>
    

    You can get a more information about IValueConverter from MSDN.

    Then use can use this value converter anywhere you’d like. You could pull it out of the Window resources and make it a application-level resource so you don’t have to specify it in every window.

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

Sidebar

Related Questions

Im developing a simple console application using java. I want to display currently running
I started developing simple application in WPF and XAML. I want to try accessign
I'm developing a simple msn client using java, but i don't know how to
I am developing simple application using JSF with richfaces. I want to upload folder(select
I developing a simple 3D model viewer on XNA 4.0. Is there a way
I developing the simple UIApplication in which i want to crop the UIImage (in
I've been developing a simple website using asp.net MVC and I'm starting to add
I am developing a simple platform game in Java using BlueJ. Over the next
I am developing a simple translator from MathML to Latex, using Lex and Yacc.
i'm developing simple cms application. i want to integrate number of hits for some

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.