Datepicker - disabled foreground color Windows Phone 8.1 RT -
how set foreground of datepicker disabled state?
i have try set style res:
<solidcolorbrush x:key="datepickerforegroundthemebrush" color="#444444" />
and:
dpdate.isenabled = false; dpdate.foreground = new solidcolorbrush(colors.black);
but still transparent.
you need modify template of datepicker control in order change it's behavior when in disabled visual state; actually, there button inside datepicker , need change behavior of button.
- in designer, right click on datepicker , select edit template -> edit copy -> ok. designer has generated style control.
- perform step 1 again generate style button inside date picker.
- go xaml view. there 2 style elements under page.resources element: buttonstyle1 , datepickerstyle1. find , comment following part:
xaml:
<visualstate x:name="disabled"> <storyboard> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentpresenter"> <discreteobjectkeyframe keytime="0" value="{themeresource buttondisabledforegroundthemebrush}" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="borderbrush" storyboard.targetname="border"> <discreteobjectkeyframe keytime="0" value="{themeresource buttondisabledborderthemebrush}" /> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="background" storyboard.targetname="border"> <discreteobjectkeyframe keytime="0" value="{themeresource buttondisabledbackgroundthemebrush}" /> </objectanimationusingkeyframes> </storyboard> </visualstate>
for more explained example on customizing control templates, checkout quickstart: control templates (xaml).