Change look and feel of DateTimePicker button?

WPF Studio, Themes, and Shared Library for WPF Forum

Posted 16 years ago by David Sworder
Avatar
Is there a way for me to change the look of the dropdown button that appears to the right of the textbox in the DateTimePicker?

I tried creating an unnamed style (Target=Button) with a revised control template but this didn't seem to have any effect.

Thanks,

David

Comments (9)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Unfortunately not at this time. You'd have to retemplate the control. However I believe Blend lets you load default styles and modify them. So that is an option. Or alternatively, if you are a customer, we're happy to send you our default style XAML source.


Actipro Software Support

Posted 16 years ago by David Sworder
Avatar
I figured out an ugly hack to make it work.

You basically have to use VisualTreeHelper to dig down through the DateTimePicker until you reach an object whose type is ButtonChrome. Setting the Child property of that object to an image will replace the standard dropdown button with an image of my choosing.

The ButtonChrome object is only present in the Vista/Aero theme. That's ok though, because when running a non-Vista theme (on XP, 2003, etc.), the default dropdown button looks just fine. Vista/Aero is the only OS in which the button is hideous looking [not actipro's fault -- it's just an obnoxious Aero effect].

David
Posted 16 years ago by David Mullin
Avatar
This is a different David - but if you could provide me with the default template for the DateTimePicker control, that would be excellent!

And, if you could also provide the default template for the MonthCalendar control, that might be very helpful for us as well.

Thanks in advance!

David Mullin
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok, they have been emailed over.


Actipro Software Support

Posted 16 years ago by David Mullin
Avatar
I got them - thanks!
Posted 16 years ago by David Mullin
Avatar
So, using the styles and templates you sent me, I was able to do all the things that I wanted, except one (possibly because it can't be done from the style).

We'd like the calendar popup for the DateTimePicker to have two months - the current month, and the next one. Am I correct in thinking that this isn't something that could be done from the template?

David Mullin
IMA Technologies
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi David,
We took at a look at the code and right now, that probably isn't possible with how the control is set up. We'll write down this down on the TODO list as a request though.


Actipro Software Support

Posted 14 years ago by Andy Fouse
Avatar
Can I get a copy of the templates as well? We have a site license for the WPF Studio.

Thanks in Advance

Andy
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Andy,

If you are a WPF Studio customer, there will be a link in your Organization Purchases page to download the XAML styles for WPF Studio. You can grab everything directly from there.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.