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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:56:11+00:00 2026-05-19T04:56:11+00:00

I want the Button control’s property to be IsEnabled=False until a value is entered

  • 0

I want the Button control’s property to be IsEnabled="False" until a value is entered into a TextBox in the Window.

Code so far:

<Button
  Content="Click Me"
  Name="ClickMe"
  VerticalAlignment="Top"
  Click="ClickMe_Click">
  <Button.Style>
    <Style>
      <Style.Triggers>
        <DataTrigger
          Binding="{Binding ElementName=textBox, Path=Length}"
          <!-- or even: Binding="{Binding Path=textBox.Length}" -->
          Value="0">
          <Setter
            Property="Button.IsEnabled"
            Value="false" />
          </DataTrigger>
      </Style.Triggers>
    </Style>
  </Button.Style>
</Button>

Also, is it possible to have this Button control’s IsEnabled property be based on 3 different TextBox controls all having values?

  • 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-19T04:56:12+00:00Added an answer on May 19, 2026 at 4:56 am

    Assuming you are employing a presentation model, such as a ViewModel, you should bind directly the data instead of the UI elements.

    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding FirstName}" Value="{x:Null}" />
                <Condition Binding="{Binding MiddleName}" Value="{x:Null}" />
                <Condition Binding="{Binding LastName}" Value="{x:Null}" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Button.IsEnabled" Value="False" />
        </MultiDataTrigger>
    </Style.Triggers>
    

    That said, if you are using a presentation model, you can always add a bool "EnableSave" property and handle all the presentation logic there instead of in the view itself.

    update

    As can be seen by following the comments, I mistakenly set this up to enable the Button when any TextBox has a value, but the requirement is that the Button be enabled when all TextBoxes have values.

    Conceptually, all you have to do is reverse the conditions — instead of "false if all conditions false," we want "true if all conditions true."

    The catch is that there is no way to say "not null" in the XAML — no way without an IValueConverter, that is. I’d create a NullToBoolConverter that returns false for null and true for != null.

    Given such a converter:

    <Style.Triggers>
        <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
                <Condition Binding="{Binding FirstName,
                    Converter={StaticResource NullToBoolConverter}}" Value="True" />
                <Condition Binding="{Binding MiddleName,
                    Converter={StaticResource NullToBoolConverter}}" Value="True" />
                <Condition Binding="{Binding LastName,
                    Converter={StaticResource NullToBoolConverter}}" Value="True" />
            </MultiDataTrigger.Conditions>
            <Setter Property="Button.IsEnabled" Value="True" />
        </MultiDataTrigger>
    </Style.Triggers>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add current system time information into NumericUpDown Button control. Does this
I make a image into button control. Now i want to change that image
I want to add a custom property to a button in window form. Currently
If I have the following code and want to align button control to horizontally
I want to add a column to a gridview which contains button control. I
I have a System.Windows.Forms.Button control, and I want to add a hover-text explanation of
I have two array and three button in segment control i want that when
I want to hide the Next button on my ASP.NET Wizard control using JavaScript.
I have a user control that contains multiple controls (CheckBox, Button, Label...). I want
If I want to create a button control like that, is it supposed to

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.