<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Validate on button click?</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Validate on button click?</description>
  <pubDate>Wed, 10 Jun 2026 17:29:46 -700</pubDate>
  <lastBuildDate>Tue, 31 Aug 2010 13:20:28 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2006</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Validate on button click? : Mike,  Thanks that is the way...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8295#8295</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=916" rel="nofollow">BringerOD</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 31-Aug-2010 at 1:20pm<br /><br />Mike,<DIV>&nbsp;</DIV><DIV>Thanks that is the way to go for WPF currently.</DIV><DIV>&nbsp;</DIV><DIV>Bryan</DIV>]]>
   </description>
   <pubDate>Tue, 31 Aug 2010 13:20:28 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8295#8295</guid>
  </item> 
  <item>
   <title>Validate on button click? : If you set the default verifier...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8294#8294</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 31-Aug-2010 at 1:11pm<br /><br />If you set the default verifier option mode, this should happen.<br><br>Manager.VerifierEngine.DefaultVerifierOptions.ErrorNotificationMode = VerifierErrorNotificationMode.ThrowException<br><br>of course, you'll need to use ValidatesOnExceptions=true in your xaml.<br>]]>
   </description>
   <pubDate>Tue, 31 Aug 2010 13:11:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8294#8294</guid>
  </item> 
  <item>
   <title>Validate on button click? : Mike,  Thanks for the post....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8268#8268</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=916" rel="nofollow">BringerOD</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 28-Aug-2010 at 11:05am<br /><br />Mike,<DIV>&nbsp;</DIV><DIV>Thanks for the post.&nbsp; Is there a way to run the validation when the user leaves the field.&nbsp; Not just on the button click.</DIV><DIV>&nbsp;</DIV><DIV>I tried it using an interceptor and it worked.&nbsp; I was hoping a global solution would be around. Maybe an interceptor that works on all fields and tried to verify after each set. </DIV><DIV>&nbsp;</DIV><DIV>Bryan</DIV>]]>
   </description>
   <pubDate>Sat, 28 Aug 2010 11:05:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=8268#8268</guid>
  </item> 
  <item>
   <title>Validate on button click? : Thanks very much for posting your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7949#7949</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 02-Aug-2010 at 11:36am<br /><br />Thanks very much for posting your solution, Mike!]]>
   </description>
   <pubDate>Mon, 02 Aug 2010 11:36:19 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7949#7949</guid>
  </item> 
  <item>
   <title>Validate on button click? :   Thanks Greg. I came up with...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7913#7913</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 29-Jul-2010 at 7:37am<br /><br />Thanks Greg.&nbsp; I came up with two ways to do it in an injected base class.<br><br>In the interest of helping any other developers with the same question, here's one way.&nbsp; (It's not fun finding forum posts with "I figured it out," but no answer as to how.)&nbsp; This way clears the error until Verify() is called again.&nbsp; Bindings need to include ValidatesOnDataErrors=true.<br><br>public abstract partial class EntityBase : IDataErrorInfo<br>{<br>&nbsp; private Dictionary&lt;string, string&gt; _errorList;<br>&nbsp; private Dictionary&lt;string, string&gt; ErrorList<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; get { return _errorList ?? (_errorList = new Dictionary&lt;string, string&gt;()); }<br>&nbsp; }<br>&nbsp; private bool _isVerifying;<br><br>&nbsp; /// &lt;summary&gt;<br>&nbsp; /// Verify the specific entity, setting errors on properties not passing validation.<br>&nbsp; /// &lt;/summary&gt;<br>&nbsp; /// &lt;returns&gt;<br>&nbsp; /// True if the entity passes validation.&nbsp; False if there are errors.<br>&nbsp; /// &lt;/returns&gt;<br>&nbsp; public bool Verify()<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; ErrorList.Clear();<br><br>&nbsp;&nbsp;&nbsp; var verifiers = verifierEngine.Execute(this)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Where(v =&gt; (v.ResultCode == VerifierResultCode.Error) || (v.ResultCode == VerifierResultCode.OkWarning))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .ToList();<br><br>&nbsp;&nbsp;&nbsp; _isVerifying = true;<br>&nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (var verifierResult in verifiers)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var triggers = verifierResult.Verifier.TriggerLinks;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (var propertyName in triggers.Select(trigger =&gt; trigger.TriggerItem.MemberName))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ErrorList.ContainsKey(propertyName))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorList&#091;propertyName&#093; += Environment.NewLine + verifierResult.Message;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorList.Add(propertyName, verifierResult.Message);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (GetType().GetProperty(propertyName) != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EntityAspect.ForcePropertyChanged(new PropertyChangedEventArgs(propertyName));<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; finally<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _isVerifying = false;<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; return verifiers.Count == 0;<br>&nbsp; }<br><br>&nbsp; /// &lt;summary&gt;<br>&nbsp; /// Hide the error whenever the property is changed until Verify() is called again.<br>&nbsp; /// &lt;/summary&gt;<br>&nbsp; protected override void OnPropertyChanged(PropertyChangedEventArgs e)<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; base.OnPropertyChanged(e);<br>&nbsp;&nbsp;&nbsp; if (_isVerifying) return;<br><br>&nbsp;&nbsp;&nbsp; if (string.IsNullOrEmpty(e.PropertyName)) return;<br><br>&nbsp;&nbsp;&nbsp; if (ErrorList.ContainsKey(e.PropertyName))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorList.Remove(e.PropertyName);<br>&nbsp; }<br><br>&nbsp; public new string this&#091;string propertyName&#093;<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; get { return ErrorList.ContainsKey(propertyName) ? ErrorList&#091;propertyName&#093; : null; }<br>&nbsp; }<br><br>&nbsp; public string Error { get { throw new NotImplementedException(); } }<br>}<br><span style="font-size:10px"><br /><br />Edited by mikewishart - 03-Aug-2010 at 5:52am</span>]]>
   </description>
   <pubDate>Thu, 29 Jul 2010 07:37:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7913#7913</guid>
  </item> 
  <item>
   <title>Validate on button click? : The WPF UI machinery predates...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7834#7834</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 27-Jul-2010 at 5:34pm<br /><br />The WPF UI machinery predates the INotifyDataErrorInfo interface (which is implemented by DevForce entities), so the WPF UI doesn't listen for the ErrorsChanged event that an entity raises when an error is added to its ValidationErrors collection. You'll need to wire up a handler yourself.]]>
   </description>
   <pubDate>Tue, 27 Jul 2010 17:34:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7834#7834</guid>
  </item> 
  <item>
   <title>Validate on button click? :  This is for WPF Edited by mikewishart...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7821#7821</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 27-Jul-2010 at 10:54am<br /><br />This is for WPF<span style="font-size:10px"><br /><br />Edited by mikewishart - 27-Jul-2010 at 11:01am</span>]]>
   </description>
   <pubDate>Tue, 27 Jul 2010 10:54:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7821#7821</guid>
  </item> 
  <item>
   <title>Validate on button click? : Are you working in WPF or Silverlight?...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7820#7820</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 27-Jul-2010 at 10:53am<br /><br />Are you working in WPF or Silverlight?]]>
   </description>
   <pubDate>Tue, 27 Jul 2010 10:53:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7820#7820</guid>
  </item> 
  <item>
   <title>Validate on button click? : I was wondering if there&amp;#039;s...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7804#7804</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=704" rel="nofollow">mikewishart</a><br /><strong>Subject:</strong> 2006<br /><strong>Posted:</strong> 26-Jul-2010 at 11:57am<br /><br />I was wondering if there's an easy way to validate an entity on a button click rather than setting up the verification engine to update as every property is changed (ala: Manager.VerifierEngine.DefaultVerifierOptions.ErrorNotificationMode = VerifierErrorNotificationMode.ThrowException).<br><br>If I have XAML like this:<br><font color="#3300ff">&lt;TextBox&nbsp; Text="{Binding Employee.FirstName, Mode=Default, ValidatesOnExceptions=True}"/&gt;<br><br>&lt;Button Content="Validate" Command="{Binding BtnValidateClick}"/&gt;<br></font><br>and in my viewmodel, I have a property and method:<br><font color="#3300ff">public static Employee Employee { get; set; }<br><br>public ICommand BtnValidateClick { get; set; }<font color="#336633">&nbsp; // this gets set to OnBtnValidateClick in the vm constructor</font><br>public void OnBtnValidateClick(object parameter)<br>{<br>&nbsp; var result = Manager.VerifierEngine.Execute(Employee).Where(r =&gt; r.IsError || r.IsWarning);<br>}</font><br><br>What can I do with the result to tell the entity to go throw errors on all the properties with failed verifiers?&nbsp;&nbsp; I'm thinking there's something simple I'm missing here.<br><br>Thanks!<br>]]>
   </description>
   <pubDate>Mon, 26 Jul 2010 11:57:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2006&amp;PID=7804#7804</guid>
  </item> 
 </channel>
</rss>