Sridhar D
Sridhar D

Reputation: 1

XamDateTimeEditor - user should select the date from the dropdown calender only -- WPF/MVVM

I have XamDateTimeEditor control in the XAML(code given below). Currently the user is able to type in the date or select from the calender dropdown. But I don't want the XamDateTimeEditor to allow any users to type in any date through keyboard, it should only be done by the dropdown using mouse.

here is the code in XAML -

  <igEditors:XamDateTimeEditor x:Name="xamDateTimeEditorEntryDate"
                                     AutoFillDate="MonthAndYear"
                                     IsAlwaysInEditMode="True"
                                     Mask="mm/dd/yyyy"
                                     Text="{Binding EntryDate,
                                                    Mode=TwoWay,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    ValidatesOnDataErrors=True}" />

Upvotes: 0

Views: 1482

Answers (1)

Stefan
Stefan

Reputation: 241

You can handle the XamDateTimeEditor's PreviewKeyDownEvent and set the e.Handled Proprty to true in the event handler. This way the user won't be able to enter anything using the Keyboard.

Upvotes: 1

Related Questions