Is there a way to enable /disable specific dates on a XamDateTime editor control. This functionality seems to be available in the XamMonthCalendar control and I am able to do this to achieve disabled dates.
For Each itm In datelist
Dim range As CalendarDateRange = New CalendarDateRange(Convert.ToDateTime(itm.Value))
igCalendar.DisabledDates.Add(range)
Next
Or is there a way I can port this functionality from the XamMonthCalendar to the XamDateTimeEditor
Good news! The XamDateTimeEditor contains an embedded instance of the XamMonthCalendar. That means you can access this element in a number of ways and apply any customizations you want to the XamMonthCalendar properties directly.
Since this control is embedded in the XamDateTimeEditor, you could access the control using the WPF VisualTreeHelper. You could recursively search every child element (and every child within every child) until you find the XamMonthCalendar. This would be the easiest way to find the control and would be safe in case the visual layout ever changes within the control template.
You could also override the Control Template for the XamDateTimeEditor to access and customize how the XamMonthCalendar is applied to the Popup section of the control.
Another approch is to access the Template name. The XamMonthClaendar is given a template name: PART_Calendar. To access this name you would derive a control from XamDateTimeEditor and override the OnApplyTemplate method and call Template.GetName("PART_Calendar").
public override void OnApplyTemplate(){ base.OnApplyTemplate(); XamMonthCalendar calendar = this.Template.FindName("PART_Calendar") as XamMonthCalendar;}
Once you get access to the control, you can make changes to properties. Be aware, some of the properties will be set by the XamDateTimeEditor when the control is initialized and when the user makes changes.
Curtis,
This was exactly what I was looking for, a programatic way to access the embedded xamMonthCalendar inside the xamDateTimeEditor. However, I am not having success with the samples above.
Using Snoop it seems that the calendar is actually part of a popup in the adorner layer and I cannot find it in the VisualTree of the DateTimeEditor or in the Template by name. Did the structure of the control change?
Thanks for any tips.
Hi,
I know this post is old, but I figured I would try anyway.
Anyway to Bind the property to a variable?
i.e. <InfraEditor:ValueConstraint MinInclusive="{Binding ProposedDateStart}">
This was the ViewModel would allow me to set it.
Ira
What about this topic??
OK. This is my xaml, it is very simple.
Is this something you can replicate in a small sample project? If yes, remove binaries from the project, zip it, and add it here and I will determine what is going on and will fix the problem for you.
Thank you,
Hello!!
I'm using the XamMaskEditor and it throws this error "Input does not match the mask" when the editor loses the focus. The only property I'm using is this Mask="{}{date}{time}". When I run the code I set a value like this 12/29/2010_04:10 AM, then the error message appears. Thanks for your help!!