Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1405
XamDateTimeEditor focus problem
posted

Hy all.

I have a question about the XamDateTimeEditor control.

I have a simple wpf application with a form for which I set the DataContext to a Controller class.

In this Controller class I have an object that has two properties. The DateTime property (DateValue) it's bounded to the XamDateTimeEditor value and the string property (TextValue) it's bounded to a TextBox control.

I have noticed that every time when the XamDateTimeEditor gets the focus, it will call the set method for the DateValue of the object even if the DateValue was not changed. For the TextBox control it will call the set method of the TextValue property only after losing the focus on the control.

Do you know if I must do something so that the XamDateTimeEditor will not call the set method when it gets the focus? I have also attached a sample.

Thanks a lot.

Nico

WpfXamDateTimeTest.zip
Parents
No Data
Reply
  • 69686
    posted

    Hello Nico,

    I am not sure why the XamDateTimeEditor behaves like this, maybe someone else can answer this question for me, but I cannot see the behavior you describe for the TextBox. It does not fire anything if you have not changed the value.

    Regarding the Set, you can use the following to make sure that the value will be set only if it is changed:

    set

    {

                    if (this.dateValue != value)

                    {

                        this.dateValue = value;

                        NotifyPropertyChanged("DateValue");

                    }

    }

    Hope this helps.

Children