Does anyone know of a way to "Open" (like when you click on it and get the dropdown) the datetimepicker? My goal is to have it open when focus is set to the control. Any ideas?
Printable View
Does anyone know of a way to "Open" (like when you click on it and get the dropdown) the datetimepicker? My goal is to have it open when focus is set to the control. Any ideas?
You could use the raiseevent method I believe. I havent tested this but its just an example:
Another way is the datepicker has a IsDropDownOpen property that you could set on the gotfocus method.Code:Button myButton = new Button();
myButton.RaiseEvent(new RoutedEventArgs(Button.Click, myButton));
A different method would be taking the date picker and editing its template. Then you could create trigger that set its IsDropDownOpen property on gotfocus.
If you have any questions just ask.
I didnt think there was a WPF DateTimePicker ? Or are you talking about the winforms version? (not sure why you posted it in the WPF forum if thats the case)
I didnt see a DateTimePicker in my Toolbox but there is a DatePicker that was added in June(I believe). You can get the latest wpf toolkit here. I just assumed that was what he was talking about.
Although this is a VB6 technique, you could use the same logic in WPF to do the same thing.
http://www.vbforums.com/showthread.php?t=251933