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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:40:24+00:00 2026-06-02T14:40:24+00:00

I have a WPF page which has a DataContext assigned to it. On this

  • 0

I have a WPF page which has a DataContext assigned to it. On this page it has a couple textboxes. Each textbox is bound to a property of a parent object from the DataContext. For instance, the DataContext has a Location object on it. The Location object has properties like “Name” and “Address1” etc.

The textbox controls are bound like this:

<Binding Path="Location.Name" Mode="TwoWay">

I have a “Commit” button that only becomes enabled once all the data is valid. This relies on the evaluation of this process after a property is set. If this wasn’t a sub property of Location, I could easily do it like this:

public Location Location
{
    get { return _location; }
    set
    {
        _location = value;
        OnPropertyChanged("Location");
        OnPropertyChanged("IsCommitEnabled");
    }
}

But since the Location object is never actually set, but rather the Location object’s “Name” property, that event never fires. Is there a way to fire off my “OnPropertyChanged(“IsCommitEnabled”)” method when a property of my Location object is modified/set?

  • 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-02T14:40:32+00:00Added an answer on June 2, 2026 at 2:40 pm

    I’m guessing your button has a Click handler and its Enabled property is bound to IsCommitEnabled. Which is fine except that you are responsible for the update of the enabled state – which is the problem you expressed.
    An alternative would be to replace the Click handler and Enabled binding with a binding to a Command.
    You can impliment the Command either as a RoutedCommand and set CanExecuteRoutedEventArgs.CanExecute to IsCommitEnable or you could provide an implimentation of ICommand where ICommand.CanExecute will check IsCommitEnabled.
    In both these case the framework looks after polling the CanExecute method – so you dont have to do a proptry update when the property changes.

    RoutedCommand example:

    <Window.CommandBindings>
        <CommandBinding
            Command="{x:Static p:Window1.StartButtonCommand}"
            Executed="buttonStart_Executed"
            CanExecute="CommandBinding_StartButtonEnabled" />
    </Window.CommandBindings>
    

    public static RoutedCommand StartButtonCommand = new RoutedCommand();
    private void CommandBinding_StartButtonEnabled(object sender, CanExecuteRoutedEventArgs e) {
        e.CanExecute = ....;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control...and the base page(s) which uses this user control has
I have a ListBox in a WPF Page each Item of which consists of
I have a frame control in a WPF app which has an HTML page
I have a WPF page that has 2 ContentControls on it. Both of the
I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have WPF Form which has many buttons with the same code. Appearance of
I have WindowsFormsHost inside the WPF page say Page1 WindowsFormsHost has child winform say
I have an WPF application which has a local rdlc report which show receipt
I have a WPF page. Page has some content, but the last child component
I have a WPF Window which has a among other controls hosts a Frame.

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.