<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.lhotka.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'XAML', 'AddBusinessRules', and 'CSLA 4.2'</title><link>http://forums.lhotka.net/search/SearchResults.aspx?a=0&amp;g=4&amp;o=DateDescending&amp;tag=XAML,AddBusinessRules,CSLA+4.2&amp;orTags=0</link><description>Search results matching tags 'XAML', 'AddBusinessRules', and 'CSLA 4.2'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP3 (Build: 36.8414)</generator><item><title>Custom Busines Rule for numeric property</title><link>http://forums.lhotka.net/forums/p/10564/49426.aspx#49426</link><pubDate>Wed, 27 Jul 2011 07:53:12 GMT</pubDate><guid isPermaLink="false">49a2225a-bd1e-4c5d-a665-720b81e87ca9:49426</guid><dc:creator>BruderKotlett</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve a Custom Rules that checks if the user entered a valid numerical value (Double.TryParse)&lt;/p&gt;
&lt;p&gt;I override the AddBusinessRules Method and added the rule like this:&lt;/p&gt;
&lt;p&gt;BusinessRules.AddRule(new Business.CustomRules.Numerical(PreislistePos.PreisNormalProperty));&lt;/p&gt;
&lt;p&gt;It works fine, as long as the user enters a numeric value. If the user types in characters, the rule doesn&amp;#39;t checks the entered value. And the Property Status will not be shown.&lt;/p&gt;
&lt;p&gt;Property:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static readonly PropertyInfo&amp;lt;decimal&amp;gt; PreisNormalProperty = RegisterProperty&amp;lt;decimal&amp;gt;(c =&amp;gt; c.PreisNormal);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Display(ResourceType = typeof(Asego), Name = &amp;quot;PreisNormalText&amp;quot;)]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public decimal PreisNormal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return GetProperty(PreisNormalProperty); }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { SetProperty(PreisNormalProperty, value); }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;XAML:&lt;/p&gt;
&lt;p&gt;&amp;lt;TextBox Grid.Column=&amp;quot;2&amp;quot; Height=&amp;quot;23&amp;quot; Name=&amp;quot;preisNettoTextBox&amp;quot; Text=&amp;quot;{Binding Path=CurrentSelectedPreislistePos.PreisNetto, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}&amp;quot; VerticalAlignment=&amp;quot;Center&amp;quot; Margin=&amp;quot;10,4,30,5&amp;quot; BorderBrush=&amp;quot;{Binding Path=IsValid, ElementName=preisNettoStatus, Converter={StaticResource validbrushConverter}}&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;csla:PropertyStatus x:Name=&amp;quot;preisNettoStatus&amp;quot; Property=&amp;quot;{Binding Path=PreisNetto, Mode=TwoWay}&amp;quot; Grid.Column=&amp;quot;2&amp;quot; VerticalAlignment=&amp;quot;Center&amp;quot; HorizontalAlignment=&amp;quot;Right&amp;quot; Margin=&amp;quot;0,0,10,0&amp;quot; IsManipulationEnabled=&amp;quot;True&amp;quot; DataContext=&amp;quot;{Binding Path=CurrentSelectedPreislistePos}&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now my question is, how to &amp;quot;fire&amp;quot; the rule if a user enter a character value in the TextBox?&lt;/p&gt;
&lt;p&gt;Thanks and kind regards&lt;/p&gt;
&lt;p&gt;Kevin&lt;/p&gt;</description></item></channel></rss>