Disable and enable buttons using variables

Jack Miller

I have a button that will be enabled or disabled with the use of a bool, I am using MVVM:

Button:

<Button x:Name="backButton" Content="Back" Command="{Binding BackCommand}" 
IsEnabled="{Binding Path=BackBool, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>

The bool:

    public bool BackBool
    {
        get { return isBackEnabled; }
        set
        {
            this.RaisePropertyChangedEvent("isBackEnabled");
            isBackEnabled = value;
            this.RaisePropertyChangedEvent("isBackEnabled");
        }
    }

I've added the bool to the variable watch and it updates correctly changing to true when the buttons should be enabled.

However the Buttons them selves do not update and always stay disabled.

Am I missing something?

Anurag

Modified version of your code

Button:

<Button x:Name="backButton" Content="Back" Command="{Binding BackCommand}" 
IsEnabled="{Binding Path=BackBool, Mode=OneWay}"/>

The bool:

public bool BackBool
{
    get { return isBackEnabled; }
    set
    {
        isBackEnabled = value;
        this.RaisePropertyChangedEvent("BackBool");
    }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to Enable and Disable Buttons

From Dev

How to enable/disable Bootstrap buttons remotely using jquery?

From Dev

Javascript to disable or enable radio buttons

From Dev

How to enable /disable buttons in jquery?

From Dev

Javascript to disable or enable radio buttons

From Dev

PHP daily disable / enable buttons

From Dev

enable/disable radio buttons in AngularJS

From Dev

enable and disable using javascript

From Dev

Enable/Disable Group Buttons at the same time in JavaFX

From Dev

Enable or disable primefaces datatable buttons at the certain row

From Dev

How to Create Buttons With Disable Enable Option in NSIS?

From Dev

Function for enable and disable dynamic buttons(FileSystemWatcher)

From Dev

Enable and disable text with radio buttons with javascript?

From Dev

How to enable disable a select drop down list using radio buttons with angularjs?

From Dev

Disable or enable text input forms when radio buttons are clicked, using Jquery

From Dev

Enable/Disable checkboxes using jQuery

From Dev

Enable disable textbox using jQuery

From Dev

Javascript can disable/enable buttons but can't disable radio buttons or text areas

From Java

What is the easiest way to disable/enable buttons and links (jQuery + Bootstrap)

From Dev

How to disable/enable multiple upload buttons with multiple checkboxes

From Dev

How can I enable/disable a UITextField's inputAccessoryView buttons?

From Dev

Point system and enable and disable buttons in swift programming language

From Dev

How to enable and disable buttons in a gridview in asp.net

From Dev

Accessing buttons names using variables

From Dev

how to disable enable button using in listview checkbox

From Dev

JQuery checkbox enable/disable using Jquery Mobile

From Dev

Camel: how to enable/disable endpoints using CamelContext

From Dev

Enable/disable WPF controls using RadioButtons in XAML

From Dev

enable and disable textbox by using button click

Related Related

  1. 1

    How to Enable and Disable Buttons

  2. 2

    How to enable/disable Bootstrap buttons remotely using jquery?

  3. 3

    Javascript to disable or enable radio buttons

  4. 4

    How to enable /disable buttons in jquery?

  5. 5

    Javascript to disable or enable radio buttons

  6. 6

    PHP daily disable / enable buttons

  7. 7

    enable/disable radio buttons in AngularJS

  8. 8

    enable and disable using javascript

  9. 9

    Enable/Disable Group Buttons at the same time in JavaFX

  10. 10

    Enable or disable primefaces datatable buttons at the certain row

  11. 11

    How to Create Buttons With Disable Enable Option in NSIS?

  12. 12

    Function for enable and disable dynamic buttons(FileSystemWatcher)

  13. 13

    Enable and disable text with radio buttons with javascript?

  14. 14

    How to enable disable a select drop down list using radio buttons with angularjs?

  15. 15

    Disable or enable text input forms when radio buttons are clicked, using Jquery

  16. 16

    Enable/Disable checkboxes using jQuery

  17. 17

    Enable disable textbox using jQuery

  18. 18

    Javascript can disable/enable buttons but can't disable radio buttons or text areas

  19. 19

    What is the easiest way to disable/enable buttons and links (jQuery + Bootstrap)

  20. 20

    How to disable/enable multiple upload buttons with multiple checkboxes

  21. 21

    How can I enable/disable a UITextField's inputAccessoryView buttons?

  22. 22

    Point system and enable and disable buttons in swift programming language

  23. 23

    How to enable and disable buttons in a gridview in asp.net

  24. 24

    Accessing buttons names using variables

  25. 25

    how to disable enable button using in listview checkbox

  26. 26

    JQuery checkbox enable/disable using Jquery Mobile

  27. 27

    Camel: how to enable/disable endpoints using CamelContext

  28. 28

    Enable/disable WPF controls using RadioButtons in XAML

  29. 29

    enable and disable textbox by using button click

HotTag

Archive