Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Validation problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
gunters  
View profile  
 More options Dec 7 2011, 8:37 am
From: gunters <gunter...@googlemail.com>
Date: Wed, 7 Dec 2011 05:37:45 -0800 (PST)
Local: Wed, Dec 7 2011 8:37 am
Subject: Validation problem
Hi,

we have a strange problem with the ReactiveValidationObject here.

We have a view with a textbox bound to a ViewModel property. This
property has the [Required] attribute set so there is a validation
error if the property is empty.

The property is set correctly to a non-empty string and the textbox is
displaying it. Still, the textbox shows a validation error. This
validation error immediatly goes away on further changes of the
textbox content or the ViewModel property, its only a first-time
issue.

Our View is a bit special because we first set the viewmodel
properties, after that we switch a DataTemplate in a ContentControl of
the view. I guess this is what surfaces this problem.

We had a debugging session and made the following observations:

- raisePropertyChanged in ReactiveObject first fires the
propertyChangedEvent, then it notifies the Changed Observable.
- The Changed observable is subscribed to in the constructor of
ReactiveValidatedObject, here the validationCache is refreshed.
- When our ViewModel was setting its property the raisePropertyChanged
was fired first. This triggered the View to read the IDataErrorInfo
(string this[string columnName]) in the ReactiveValidatedObject. The
validationCache still had an error set because before we load all the
properties of our ViewModel we clear all the fields first.
- Only after that ReactiveValidatedObject stepped into the anonymous
delegate of this.Changed.Subscribe in his constructor and refreshed
the validation cache.
- We could work aorund the problem with firing another
PropertyChangedEvent after our property is set.

There was already another thread were there was suggested to swap the
order of the raisePropertyChanged firing and the Changed observable
notification in raisePropertyChanged. I guess this also would work in
our case.

http://groups.google.com/group/reactivexaml/browse_thread/thread/a887...

Wouldn't it be generally better to first fire the "internal" event
(Changed) and then the "external" PropertyChangedEvent (where WPF and
the views bind to)? This would guarantee that WPF sees correct state
of the ValidationInfo in this case.

Regards,
Gunter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gunters  
View profile  
 More options Jan 5 2012, 10:43 am
From: gunters <gunter...@googlemail.com>
Date: Thu, 5 Jan 2012 07:43:57 -0800 (PST)
Local: Thurs, Jan 5 2012 10:43 am
Subject: Re: Validation problem
Paul,

we are still using the workaround for our problem as it is described
above. But its looks ugly :).

Is there are better way, what do you think?

Regards,
    Gunter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Betts  
View profile  
 More options Jan 6 2012, 8:26 pm
From: Paul Betts <paul.be...@gmail.com>
Date: Fri, 6 Jan 2012 17:26:43 -0800
Local: Fri, Jan 6 2012 8:26 pm
Subject: Re: Validation problem
Send me a pull request with the change you're proposing


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »