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

  • Home
  • SEARCH
  • 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 9181473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:19:21+00:00 2026-06-17T18:19:21+00:00

My WPF-Application contains a DataGrid with 3 Columns and a disabled Button. One Column

  • 0

My WPF-Application contains a DataGrid with 3 Columns and a disabled Button.
One Column of my DataGrid is a DataGridCheckBoxColumn. Now I want to bind Button’s IsEnabled-Property, to be enable if at least one of them is checked, else remain disabled.

Actually I’ve following implementation:

<Button x:Name="buttonStart" Content="Start" IsEnabled="{Binding Converter={StaticResource ButtonEnableConverter}, ElementName=gridTestCaseChooser}" />

But the Converter is only called once at startup the application. If the DataGrid content change, or I check/uncheck a CheckBox, there isn’t a new call to my converter.

How could I do this?

  • 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-17T18:19:22+00:00Added an answer on June 17, 2026 at 6:19 pm

    Using MVVM can be very easy:

    1. Declare an ICommand property to execute the logic of the button with a RelayCommand.
    2. The items you add must implement INotifyPropertyChanged interface and have a bool IsChecked property firing PropertyChanged event.
    3. Every time a new item is added, subscribe to its PropertyChanged event and when removed, remove the hook as well.
    4. Every time the hooking method is called, fire the PropertyChanged for the ICommand property.
    5. In XAML just bind the button to the ICommand property.

    ViewModels

        public class Item: INotifyPropertyChanged
        {
            private bool isChecked;
            public event PropertyChangedEventHandler PropertyChanged;
            public bool IsChecked
            {
                get
                {
                    return this.isChecked;
                }
                set
                {
                    this.isChecked = value;
                    var propertyChangedEvent = PropertyChanged;
                    if(propertyChangedEvent != null)
                    {
                        propertyChangedEvent(this, new PropertyChangedEventArgs("UpdateSomething");
                    }                
                }
            }
        }
    
        public class MyViewModel : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            public ICommand UpdateSomething { get; private set; }
            public ObservableCollection<Item> MyItems { get; set; }
    
            public MyViewModel()
            {
                UpdateSomething = new RelayCommand(MyCommandExecute, MyCommandCanExecute);
                MyItems = new ObservableCollection<Item>();
            }
    
            private void MyCommandExecute(object parameter)
            {
                // Your logic here.
            }
    
            private void MyCommandCanExecute(object parameter)
            {
                return MyItems.Any(item => item.IsChecked);
            }
    
            private void AddItem(Item item)
            {
                item.PropertyChanged += ItemsPropertyChanged;
                MyItems.Add(item);
            }
    
            private void ItemsPropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                var propertyChangedEvent = PropertyChanged;
                if(propertyChangedEvent != null &&
                   e.PropertyName == "IsChecked")
                {
                    propertyChangedEvent(this, new PropertyChangedEventArgs("UpdateSomething");
                }                
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application uses a WPF DataGrid . One of the columns is a template
I am making a WPF-application.I have a datagrid with a column header that contains
I've got a WPF application which contains a standard DataGrid showing a lot of
I want my WPF application to have a ToggleButton that contains an image of
We have a WPF windows application that contains a stackpanel control, that I want
I've got a DataGrid control in my WPF application that contains an object. There
I have a DataGrid that two of its columns are ComboBoxes (one contains few
I have a WPF C# application that contains a button. The code of the
I'm working on a WPF application that contains a wrapper UI that is actually
Guys, I have a basic WPF application. Contains App.xaml as always and a Mainwindow.xaml.

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.