xaml - How to change the default style of CheckBox control in Universal Windows Platform? -
i don't know how change checkbox's default color.i coded line checkbox
<checkbox x:name="chkrememberme" foreground="gray" grid.row="4" background="transparent" ischecked="false" tabindex="3" horizontalalignment="center" verticalalignment="top" background="blue" margin="0,2,0,0" /> in below image, have mentioned style of checkbox require.
open designer window, right click on checkbox, choose edit template -> edit copy (or same in blend). should create default style in resources (you can find style here @ msdn).
in style find want. background color looking changed visualstatemanager - edit suitable visual states , should work. sample - changed value of normalrectangle.fill property systemcontrolbackgroundbaselowbrush:
<visualstate x:name="checkednormal"> <storyboard> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="normalrectangle"> <discreteobjectkeyframe keytime="0" value="{themeresource systemcontrolbackgroundbaselowbrush}"/> </objectanimationusingkeyframes> <doubleanimation duration="0" to="{themeresource checkboxcheckedstrokethickness}" storyboard.targetproperty="strokethickness" storyboard.targetname="normalrectangle"/> <objectanimationusingkeyframes storyboard.targetproperty="stroke" storyboard.targetname="normalrectangle"> <discreteobjectkeyframe keytime="0" value="{themeresource systemcontrolhighlightalttransparentbrush}"/> </objectanimationusingkeyframes> <doubleanimation duration="0" to="1" storyboard.targetproperty="opacity" storyboard.targetname="checkglyph"/> </storyboard> </visualstate> sample image:
note may need edit other visual states 1 mentioned above - depends on need.


Comments
Post a Comment