views:

821

answers:

2

How can I set the System.Windows.Controls.DatePicker control as used within a Silverlight project to ReadOnly ?

There doesn't seem to be any properties that I can set within the Xaml or code behind.

+1  A: 

Why would you want to?

DatePicker is a glorified combobox that drops down a calendar rather than a list. If it's to become read only then it would effectively be a read only text box?

< edit > If it's purely for a looks thing then, then a workaround is make a copy of the controls template and edit it so that it's Disabled state looks the same as it's Active state and then set it to disabled when you need read-only behaviour.

Graeme Bradbury
The reason is so that I can just show the same control without having to change it to a text box in a read only situation. I would basically just need it to show the date without the user being able to change it by either typing it directly into the text box part or via the dropdown calendar.
cyberbobcat
A: 

What about just handling the date change event and suppressing it and reverting it back to today's date (or some other set date)?

Gautam