Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
96
XamDateTimeEditor yyyy mask
posted

Hello,

I have a xamDateTimeEditor which I would like to limit to year entry only. The xaml I used is below

 

<igEditors:XamDateTimeEditor Name="editor" Mask="yyyy" Format="yyyy"

                                     MaxWidth="80" MinWidth="80" 

                                     IsAlwaysInEditMode="False" DisplayMode="IncludeBoth" 

                                     Height="23" VerticalAlignment="Center"

                                     DropDownButtonDisplayMode="Always"  AlwaysValidate="True"

                                     AllowDropDown="True"">

 

 

however this causes the drop down for the XamMonthCalendar to be hidden, and when I go into edit mode the display changed from 2010 to yyyy.  

I have also tried to apply the following style to no avail. 

 

 

<Style TargetType="{x:Type igEditors:XamMonthCalendar}">

           <Setter Property="TodayButtonVisibility" Value="Collapsed" />

<Setter Property="MinCalendarMode" Value="Years" />

<Setter Property="CurrentCalendarMode" Value="Years" />

</Style>

 

Is there a way to constrain the XamDateTimeEditor and its XamMonthCalendar to year selection only?

Thanks

 

  • 54937
    Verified Answer
    Offline posted

    Essentially the xamMaskedEditor (which is the base class of xamDateTimeEditor) will not recognize a series of y's as a year section unless there are other date related sections. When there are no date related sections the AllowDropdown of the xamDateTimeEditor is resolved/coerced to false since a date dropdown would not be function without date sections to hold the date information (e.g. if you were using the xamDateTimeEditor to just show/edit time). You may want to submit a suggestion for supporting this.