Results 1 to 5 of 5

Thread: Programmatically Open Datetimepicker

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2007
    Location
    Miami, FL USA
    Posts
    171

    Question Programmatically Open Datetimepicker

    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?

  2. #2
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    448

    Re: Programmatically Open Datetimepicker

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

    Code:
    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.
    If I helped you please rate me.

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Programmatically Open Datetimepicker

    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)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4
    Hyperactive Member
    Join Date
    Jan 2009
    Posts
    448

    Re: Programmatically Open Datetimepicker

    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.
    If I helped you please rate me.

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Programmatically Open Datetimepicker

    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
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width