SilverlightShow: Data Validation in Silverlight Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) RE: Data Validation in Silverlight 3 <p>Good solution.</p> <p>This really helps me. Happy Codding!!!</p> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment4229 Hardik gheewala http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Thu, 12 Aug 2010 16:13:59 GMT RE: Data Validation in Silverlight 3 <p>good</p> <p> </p> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment3074 kiran dada http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Fri, 12 Feb 2010 13:56:05 GMT RE: Data Validation in Silverlight 3 hello i am very new to silverlight and i have downloaded the source code and run with visual studio. it throws exceptions...."Unhandled by user code " .......thus i tried adding <span style="color: #ff0000; font-size: 13px;">BindingValidationErrors. </span>But it is not working does anyone knows of other ways to do validations ?  it shouldn't be the way to throw exceptions in setter methods right ? if it is the way ... how do i actually handle the exception http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment3019 panda http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Sat, 30 Jan 2010 06:00:51 GMT RE: Data Validation in Silverlight 3 Try my demo at <p>http://silverlightentityfw.codeplex.com</p> <p>I've done validation support also </p> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment2773 hack2root http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Tue, 15 Dec 2009 14:00:49 GMT RE: Data Validation in Silverlight 3 what would you suggest for auto generated classes?<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1937 jt http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Tue, 14 Jul 2009 13:38:39 GMT RE: Data Validation in Silverlight 3 Right <span id="ctl00_cphMiddle_ContentPlaceHolderContent_itemComments_dlstComments_ctl18_lblCommentAuthor">Jon</span> I agree with you. Its a bit problem to have it in auto generated classes.<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1613 Tanmoy http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Wed, 27 May 2009 00:28:55 GMT RE: Data Validation in Silverlight 3 Nice...and it works! http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1505 eye http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Thu, 23 Apr 2009 10:23:11 GMT RE: Data Validation in Silverlight 3 I agree with the person that said that doing it this way is "dead wrong." I don't think the validation rules should be in the setters of the data model. One place where this becomes problematic is if you are using WCF proxy generated classes where the setters are generated for you. What about ValidationRule like in WPF? I hope Microsoft gets this right because I agree that a "major point in building line-of-business applications is the data validation." I don't think they have it totally right even in WPF, but, not having ValidationRule in Silverlight is worse. http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1409 Jon http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Thu, 02 Apr 2009 19:11:08 GMT RE: Data Validation in Silverlight 3 You can attribute your class' properties, but if there is no one to process them (as with the case of the DataForm) they are just useless. The attributes are processed (read validated) out-of-the box by the DataForm. There is no built-in mechanism that will validate your data by the rules set in the attributes if you don't put your controls inside a DataForm. Of course, you can do that by yourself - write a control that takes those attributes in mind.<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1314 emil http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Fri, 27 Mar 2009 02:35:30 GMT RE: Data Validation in Silverlight 3 So do you say that these kind of validations (with Custom validation) will be alvailabe only for DataForm? http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1293 McpGza http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Thu, 26 Mar 2009 07:29:04 GMT RE: Data Validation in Silverlight 3 @McpGza, yes this is used when validating data inside a DataForm. We are preparing an article on this topic. Expect it tomorrow or in the beginning of the next week. http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1291 emil http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Thu, 26 Mar 2009 05:13:06 GMT RE: Data Validation in Silverlight 3 Hi,<br /> <br /> But there is a new assembly and namespace (System.ComponentModel.DataAnnotations), probably desinged to validation. Do you know about it somtehing? How can it be used? http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1282 McpGza http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Wed, 25 Mar 2009 11:54:26 GMT RE: Data Validation in Silverlight 3 Martin, you are somewhat right, but that's the only built-in way to do data validation in that version. Throwing exceptions in proprties just to say 'hey that input is invalid' is not the pretties way to validate user input. I wish we have the opportunety to use IDataErrorInfo, but it seems we have to wait a bit longer. http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1280 emil http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Wed, 25 Mar 2009 10:34:54 GMT RE: Data Validation in Silverlight 3 I think that throwing exception for business rules is dead wrong.<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1270 Martin Nyborg http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Tue, 24 Mar 2009 16:19:23 GMT RE: Data Validation in Silverlight 3 @Bill, thanks, I fixed the typos.<div><br /></div><div>@Memo, you can avoid that by applying [System.Diagnostics.DebuggerHidden()] attribute on the property. Notice that you may still get the VS Just-in-Time Debugger dialog asking you whether you want to debug it.</div> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1261 emil http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Tue, 24 Mar 2009 03:50:09 GMT RE: Data Validation in Silverlight 3 Visual studio keeps breaking when the exception is thrown.  How do I avoid this behavior, yet have it still break for other exceptions?<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1256 memo http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Mon, 23 Mar 2009 16:09:57 GMT RE: Data Validation in Silverlight 3 Thanks for the explanation.  I like the way they have implemented the validation.<br /> <br /> Minor point:  You have a few typos third to last paragraph (...this triggerr is fired on PorpertyChanged event...).<br /> http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx#comment1243 Bill http://www.silverlightshow.net/items/Data-Validation-in-Silverlight-3.aspx Sat, 21 Mar 2009 16:59:44 GMT