How to set property in IDataErrorInfo validator from Xaml

When using IDataErrorInfo in WPF is there a way to pass parameters to the validator. For instance I have a DueDate Datepicker. When validating for a new task I want to restrict the date allowed to today or later but when editing I need to allow for DueDates before today since a task can be edited that is past due.

My DatePicker in Xaml (.Net 4.0)

<DatePicker SelectedDate="{Binding Path=SelectedIssue.IssDueDate,
            ValidatesOnDataErrors=True}" />

My IErrorDataInfo

namespace OITaskManager.Model
    public partial class Issue : IDataErrorInfo
    // I want to set these values from the Xaml
    public DateTime minDate = new DateTime(2009, 1, 1);
    public DateTime maxDate = new DateTime(2025, 12, 31);

    public string this[string columnName]
            if (columnName == "IssDueDate")
                if (IssDueDate < minDate || IssDueDate > maxDate)
                    return "Due Date must be later than " + minDate.Date + 
                           " and earlier than " + maxDate.Date;                    
                return null;
            return null;


You could just use a custom validator on the binding. Or you could maintain a IsNew internal state on the the Issue object instance until it is no longer considered new.

Need Your Help

Multiple entities persist doctrine2 Zend

php doctrine2

I have 3 Entities Users, UserProfile and Staffs

How to I validate a password using regular expressions in javascript?

javascript regex validation

This is my code. It functions perfectly up to the password validation. It completely ignores my null test and goes straight to the actual validation but then refuses to go past it and keeps giving ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.