validationrules

Can you use ValidationRules on ListBox.SelectedItems?

I want to use ValidationRules to verify that a few ListBox controls have at least one item selected. I tried doing it this way: <ListBox ItemsSource="{Binding Path=AvailableItems}" Behaviors:MultiSelectorBehaviours.SynchronizedSelectedItems="{Binding ChosenItems}" x:Name="ListBoxItems"> <ListBox.Tag> <B...

Programatically add ValidationRules to WPF DataGrid when autogenerating columns

I want to do this in the AutoGeneratingColumn event: <my:DataGridTextColumn Header="CompanyName"> <my:DataGridTextColumn.Binding> <Binding Path="CompanyName"> <Binding.ValidationRules> <local:DataRowValidation ValidationStep="UpdatedValue" /> </Binding.ValidationRules> </Bindin...

Jquery validate: re-validate a validated form after checkbox changed with different rules

I am trying to validate a form with a couple of elements being required if a checkbox is NOT checked. Now if I submit the form the rules fire - and then I check the checkbox on - the validation rules have already fired - and even though the checkbox is now checked - the validation rules still apply and the form will not submit until I ...

How to use the previous value when validating a WPF DataGrid cell entry?

I have a WPF DataGrid. I would like to restrict the values a user may enter in a particular column, such as the following: Column A values may only increase (new value > old value). Column B values may only decrease (new value < old value). If the user-entered value is invalid, I want to revert to the previous valid value. I thought...

Multiple Validation Scenarios for EntLib - .resx style?

Currently I've got a set of EntLib validation rules defined in my classes. The rules will later change based on the client. What I'd like to do is retain my classes, and simply call the different rule sets defined somewhere for the specific client. The functionality of this is similar to storing internationalization values in a .resx ...

Validation Framework in .NET that can do edits between fields

From my experience many validation frameworks in .NET allow you to validate a single field at a time for doing things like ensuring a field is a postal code or email address for instance. I usually call these within-field edits. In my project we often have to do between-field-edits though. For instance, if you have a class like this: ...

Multiple Validation Rules and Validation Templates in WPF

Does anyone have a tactic for dealing with multiple validation rules and templates for those validation rules. Example: I want to have two validation rules (required & data) I want either... One template that can change is display depending on which rule is fired or Two templates, which get displayed depending on which rule is fired ...

BindingGroup with multiple (failing) ValidationRules

I ran into a problem today at work wherein I have a BindingGroup that has multiple ValidationRules that are failing simultaneously. Problem is, I get an ArgumentException bubbling up from withing BindingGroup.ValidateWithoutUpdate when I try and determine if there are any errors (i.e. to set the CanExecute on a command to false). I've m...

DataAnnotations [Required] Attribute doesn't cause Exception to be thrown

Hi I have an Asp.NET MVC application in which I use data annotations to add validation to some fields: [Required] [DisplayName("Course Name")] string Name { get; set; } However this doesn't seem to work as I expected. Basically If the page contains any other errors that I manually check for and throw a new RuleViolation()...

problems with validation rule

I am trying to get a validation rule to return an error. I implemented IDataErrorInfo in my model, which contains my business object properties and messages to return in the event validation fails. I also created a validation rule. The problem is, the validation rule is firing (bookmarked it) but the IDataErrorInfo reference in the rule ...

WPF ValidationRule not firing when value is null.

I'm having a problem with validation rules not firing when the initial value that they are bound to is null. For example I have this DataGridTextColumn that is in a DataGrid that has CanUserAddRows set to true. <DataGridTextColumn Header="Supplier Ref" Width="*"> <DataGridTextColumn.Binding> <Binding Path="SupplierRef" Mode="TwoWay...