Hi,
I have a Datagrid with a DateTime field in it. By Default I get the XamDateTimeEditor to edit the Value of the Field.
Is it possible to set a minimun and maximum Date like in the XamMonthCalendar. (Disabled Date Ranges)
Or do you know an workarround how to limit the selection. Maybe something like using the MonthCalendar and styling it like the DateTimeEditor...
Yours sincrealy
Thomas
Hello,
Most likely creating it in XAML is a better approach. Why is that you are looking to create the constraint in the code behind rather than in XAML? Is it just that you want to be able to change the constraints? If so, you can still define them in XAML and then access the resource and change them later. For example:
MyConstraint constraint = this.mainGrid.Resources["mc"] as MyConstraint;constraint.Max = DateTime.Today.AddDays(15);
Does this meet your needs? If not, what goal are you looking to accomplish?
Hi, I'm going through the same problem.
Your solution is working perfectly, but I can't see how to do the same but with an instance of MyConstraint defined in the code behind instead of the XAML code.
Here what I tried to do:
<igEditors:ValueConstraint MinInclusive="{Binding dateConst.Min}" MaxInclusive="{Binding dateConst.Max}"/> </Setter.Value>
in code behind :
dateConst = new MyConstraint(); dateConst.Max = new DateTime(2016, 12, 15); dateConst.Min = new DateTime(2015, 12, 15);
Thank you.
I have created a sample project for you, with the functionality you want. Basically I used a help class with Min and Max Properties, which are used to connect the XamDateTimeEditor’s MinInclusive and MaxInclusive Properties with the external editors’ values, because the ValueConstraints can only be bound to a StaticResource. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
how can we bind MinInclusive or else to view model variable???
How about binding the mininclusive setting to another xmlDateTimeEditor value ?