New Posts New Posts RSS Feed: Silverlight 4 Verification
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Silverlight 4 Verification

 Post Reply Post Reply
Author
Vincent View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Location: Tanzania
Posts: 22
Post Options Post Options   Quote Vincent Quote  Post ReplyReply Direct Link To This Post Topic: Silverlight 4 Verification
    Posted: 21-May-2010 at 6:21am
I am having a problem on how to propagate error messages onto the silverlight 4 UI during verification. Can anyone help me please.
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 21-May-2010 at 8:28am
What controls are you using?  DataForm and DataGrid respect the INotifyDataErrorInfo interface described below (and implemented by DevForce-generated Entities), and should respond automatically. I'm not sure about the state of other Silverlight controls - please check Microsoft docs.


Verification in the Silverlight UI

System.ComponentModel.INotifyDataErrorInfo is a Silverlight-only interface that defines members that data entity classes can implement to provide custom, asynchonous validation support. Important Silverlight user interface controls including the DataForm and DataGrid check for the implementation of this interface by data entities to which they are bound and provide excellent messaging in the user interface to help end users learn about and correct validation errors.

Such Silverlight user interface controls do not depend upon exceptions being thrown in order to learn about validation problems. Instead, they subscribe to an ErrorChanged event published by the entity as part of its INotifyDataErrorInfo compliance. That event is raised by the data entity whenever it believes that a change to its state might be important to some control in the user interface. The UI control, learning of such a change, can then query the data entity via its INotifyDataErrorInfo.GetErrors() method to obtain a current set of validation errors, which it may then expose to the end user as its developer sees fit.

Because of the support for INotifyDataErrorInfo by Silverlight UI controls, most developers working in Silverlight will want to set the system default for VerifierOptions.ErrorNotificationMode to Notify rather than any setting that results in exceptions being thrown for validation errors.



Back to Top
Vincent View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Location: Tanzania
Posts: 22
Post Options Post Options   Quote Vincent Quote  Post ReplyReply Direct Link To This Post Posted: 21-May-2010 at 9:16pm
Thank you for the reply
 
Using the DataForm, I changed the VerifierOptions.ErrorNotificationMode to Notify and it has worked but only with editing. When I create new entity, it does not verify.
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 24-May-2010 at 6:29pm
After creating the new Entity, are you adding it to the EntityManager?
Back to Top
Vincent View Drop Down
Newbie
Newbie


Joined: 21-May-2010
Location: Tanzania
Posts: 22
Post Options Post Options   Quote Vincent Quote  Post ReplyReply Direct Link To This Post Posted: 24-May-2010 at 8:08pm
Yes. After creating a new entity I add it to the entity manager and then set the datacontext property of the dataform to the entity.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down