Duplicated messages in PropertyStatus popup (Silverlight)

Duplicated messages in PropertyStatus popup (Silverlight)

Old forum URL: forums.lhotka.net/forums/t/9862.aspx


mesh posted on Sunday, December 12, 2010

I am having strange problem with PropertyStatus. Every time when MyRule gets executed, PropertyStatus is showing one additional "Wrong date" message in popup. That is happening ONLY if I move mouse ( to get popup message) over PropertyStatus after changing  DateSProperty property.

Silverlight, ViewModel, 4.1.0.0 (but tried 4.0.1.0)

Am I doing something wrong here?

        private class MyRule: Csla.Rules.BusinessRule
        {
            protected override void Execute(RuleContext context)
            {
                var target = (BO)context.Target;

                if(target.DateS.Value.Date < DateTime.Now.Date)
                    context.AddErrorResult("Wrong date");

            }
        }

        protected override void AddBusinessRules()
        {
           base.AddBusinessRules();
           BusinessRules.AddRule(new MyRule { PrimaryProperty = DateSProperty });
        }

            <cslaxaml:PropertyStatus Property="{Binding Path=Model.DateS}"
                                     Margin="2,0,2,0"
                                     />

Thanks,

 

Copyright (c) Marimer LLC