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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:32:20+00:00 2026-05-25T21:32:20+00:00

I’m working on making a WPF app and I have a UserControl for data

  • 0

I’m working on making a WPF app and I have a UserControl for data editing with a couple more UserControls inside it (super-simplified version):

<UserControl x:Name="ParentControlView">
    <DockPanel>
        <!-- other various controls, textblocks, etc. -->
        <Controls:DatePickerView DataContext="{Binding Path=EndDate, Mode=TwoWay}" />
        <!-- other various controls, textblocks, etc. -->
    </DockPanel>
</UserControl>

In the parent control’s ViewModel, it has a child DatePickerViewModel called EndDate which is bound to the DatePickerView control:

public class ParentControlViewModel : ViewModelBase
{
    private DatePickerViewModel _endDate;

    public DatePickerViewModel EndDate
    {
        get { return _endDate; }
        set
        {
            _endDate = value;
            RaisePropertyChanged(() => EndDate);
            RaisePropertyChanged(() => SomeProperty);
        }
    }
}

The DatePickerView control is a few comboboxes that are bound to properties in a DatePickerViewModel, nothing special.

When I run my app, the DatePickerView is initialized properly and is set to the current value, like it should be. So the get method is working fine. But when I change the controls on the DatePickerView and its ViewModel gets updated, the value bound to the parent view doesn’t get set in the parent view model (i.e. the set method never runs).

Obviously I am missing some sort of databinding hookups but for the life of me I cannot figure out what that is and I have searched all over and found nothing.

Update

Minimal working sample. Includes most of the proprietary date class I’m using, and probably some poor MVVM implementations. I’m still new at MVVM. I ripped a lot of the unnecessary code out so the date picker doesn’t work quite right, but it does what it needs to do for the purposes of this question.

You will need to get and reference MvvmFoundation.Wpf.dll (at codeplex).

  • 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-25T21:32:21+00:00Added an answer on May 25, 2026 at 9:32 pm

    The only things that would make sense (based on just the code shown) is (1) the ViewModelBase doesn’t implement INotifyPropertyChanged or (2) your DatePickerView control is doing something wrong with Dependency Properies.

    I would suggest posting a full repro, including DataPickerView and ViewModelBase.

    Edit

    Ok, took a look, and see the problem. The reason why your setter never gets called is that your EndDate (DatePickerViewModel) never changes. That sounds somewhat self-evident, but that’s the bottom line–there is no code that replaces the EndDate property completely, which is what would cause the setter code to run.

    Your drop down lists change the properties of EndDate/DatePickerViewModel, but keep in mind that changing its properties (Date, SelectedYear, etc.) does not set the instance of DatePickerViewModel, which means the setter code will not run.

    Since this is a stripped-down version, I am kind of guessing at what you ultimately want to achieve, but I think what you want is to create a DependencyProperty on the DatePickerViewModel (probably of type DateTime) that can be bound to and can notifies when the date inside the control changes.

    As a fast workaround, add the code below to make the the setter code fire. Note this is not a recommended solution–it will cause your parent and child to have references to each other, which is (at least) odd:

    //in ParentControlViewModel, change your EndDate to:
    public DatePickerViewModel EndDate
    {
      get { return _endDate; }
      set
      {
        _endDate = value;
        if (_endDate.ParentControlViewModel == null)
        {
        _endDate.ParentControlViewModel = this;
        }
        RaisePropertyChanged(() => EndDate);
      }
    }
    
    //Add to DatePickerViewModel
    public ParentControlViewModel ParentControlViewModel { get; set; }
    
    //Change Date property in DatePickerViewModel to:
    public GDate Date
    {
      get { return _date; }
      set
      {
        _date = value;
        RaisePropertyChanged(() => Date);
        if (ParentControlViewModel != null)
        {
          ParentControlViewModel.EndDate = this;
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.