Hello,
I have a XamDateTimeEditor. How can i get the month and year information shown on the XamDateTimeEditor? And i want to get date mode it shows (month, year, 12 years, 100 years, 1000 years)
As I indicated the control is lookless and as such it doesn't have any hard coded requirement to have its template contain a xamMonthCalendar and therefore it has no notion that it is there or what information it is showing. Also as I indicated you since the default template has a name on the element you can use the FindName method as I described and evaluate/manipulate the properties of the element it returns. Of course if the template were to change then that instance would change so you would only want to get the instance, check/change/use what you need and then don't hold onto the reference to it.
Once you have the xamMonthCalendar you could manipulate its DisabledDates collection if you want to disable particular dates (as that would be the only way to prevent their selection). There are examples of interacting with the xamMonthCalendar in the xamFeatureBrowser.
Note, even if you do manipulate the elements in the dropdown you'll still have to handle validating the end user input since they don't have to use the drop down - they can just type in a date.
Let me explain in more details,
Is there any way to find which month or year i am navigating when i open xamDateTimeEditor's popup.
When i click the navigate buttons (previous or next), are there any properties that show me navigating Mont, Year and the days seen in this section?
For example Month = 11 Year=2010 and Days=(26,27,28,29,30,31,1,2,3,4,5,6,....,30,30,1,2,3,4,5)
I want to get all these properties and set some days' selectable property to false (if any similar properties exist). For example 26 of October and 4 of November will be red-bold font style and can not be selected. Can i do that or not?
I tried to navigate the visual tree but i have not successful yet.
If you're referring to the xamDateTimeEditor's edit portion then you would need to get the Text/Value of the control. If you're referring to the xamMonthCalendar that exists within the dropdown of the default template of the xamDateTimeEditor then there isn't anything exposed on the xamDateTimeEditor itself as the control is lookless and the xamMonthCalendar is just in its default template - it could well support a template that doesn't have that control or isn't using that calendar control. The default template does have a name on this control so you may be able to do something like xamDateTimeEditor.Template.FindName("PART_Calendar", xamDateTimeEditor) assuming you're in edit mode (since this is only part of the edittemplate). If neither of these is what you mean then please provide more details about what you are looking for.