# .NET and More > WPF, WCF, WF >  Programmatically Open Datetimepicker

## NStuff42

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?

----------


## ngreenwood6

You could use the raiseevent method I believe. I havent tested this but its just an example:



```
Button myButton = new Button();
myButton.RaiseEvent(new RoutedEventArgs(Button.Click, myButton));
```

Another way is the datepicker has a IsDropDownOpen property that you could set on the gotfocus method.

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.

----------


## chris128

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)

----------


## ngreenwood6

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.

----------


## RobDog888

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

----------

