idataerrorinfo

WPF Triggers and DependencyProperties or How to get Validation.HasError for many fields.

This problem has several ways of being solved and that explains the complex title. I have a object that can be changed in a form in my WPF app. I wan't the save button to be Unenabled when there are validation errors in the form. I'm using IDataErrorInfo to notify to UI when there are errors and then I wan't a trigger on DataTemplate t...

Styling a TextBox with IDataErrorInfo in WPF

Hello, I'm trying to change style a text box. By now, I have made that my textbox shows an asterisc on the right of its border with this code: <Style TargetType="{x:Type TextBox}"> <Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <Grid> ...

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 Data Validation from a property setter function

Hi There, I have a class that is bound to GUI elements as follows: <TextBox Style="{StaticResource ValidatedTextBox}" Text="{Binding MaxDistance, ValidatesOnExceptions=True}" > <TextBox.Style> <Style TargetType="TextBox" > <Style.Triggers> <Trigger Property="Validation.HasError" Value="True"> <Setter Pr...

POCOs, DTOs and IDataErrorInfo

Hi Everyone, I awake this morning to a problem! In all of my components, I have a set of Business Rules which are used to validate DTOs before any changes are committed to the repository. I've been trying to figure out the best way to get validation errors back to the UI and I came across the IDataErrorInfo interface. Fantastic! How...

[Solved] Using IDataErrorInfo on related but non-mutually exclusive checkboxes

I have a series of checkboxes on a form. One or more must be checked, and if not I want to display an error icon on them until one of them is. My IDataErrorInfo implementation looks like so: public string this[string columnName] { get { switch (columnName) { case "option1": case "option2"...

c# - how do square brackets in a method declaration fit in with c#?

Hi, How do square brackets in a method declaration fit in with c#? That is I see when reading up on WPF validation one can use IDataErrorInfo with an example of the following. public string this[string propertyName] // Error handling takes place here. public string this[string propertyName] // <== IE HERE { get // etc } } ...

Prism IDataErrorInfo validation with DataAnnotation on ViewModel Entities

Hi, I'm implementing data validation in WPF using the Prism MVVM framework. I'm using clean data Entities in the ViewModel which are being bound to the presentation layer. <TextBox Text="{Binding User.Email, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}" /> I've implemented a generic implementation of IDataErrorIn...

LINQ to SQL Classes with INotifyPropertyChanged and IDataErrorInfo for WPF bindings

I use the LINQ to SQL Classes to access to my database. Now I want to use the LINQ to SQL Classes for WPF DataBindings and validation. How do I implement these two interfaces to my projects Model? Is it possible implement INotifyProperty automatically? ...

Informing ViewModel of ValidatesOnExceptions input errors

In my application I have numerical (double or int) ViewModel properties that are bound to TextBoxes. The ViewModel implements IDataErrorInfo to check if the values entered fall within acceptable ranges for the 'business logic' (e.g. height can't be a negative value). I have a number of TextBoxes per page and have a button (think 'next' i...

WPF error template not showing

Hello, I get no binding errors and this code works at another place. I haven`t found out yet what I do now differently to the code where it works and its not that much code. In UserControl.Resource: <Style TargetType="TextBox"> <Setter Property="BorderBrush" Value="DarkBlue"/> <Setter Property="BorderThickness" Value="1" /> ...

Beyond Data Validation Styling: Styling based on other properties

I hope that this question has not been asked elsewhere, but I'm having difficulty finding the right search terms to bring up any already-existing answers to this problem. I'm implementing a program in C# WPF (MVVM) with many interview-style screens where the user inputs scientific data in an orderly manner. We would like to have the T...

Using IDataErrorInfo or any similar pattern for propagating error messages

Hi all, I apologise for this question as it is rather fuzzy and there are several questions integrated but as they are so closely related I did not want to break them apart into several submissions. I am currently thinking about how to test for configuration errors in an application. There are different options available and one whic...