xaml - How do i set up borderbrush in radiobutton in windows phone? -
i have code
<radiobutton content="femenino" height="72" margin="224,118,0,0" name="rbtn_fem" verticalalignment="top" visibility="visible" borderbrush="#ffa3cd5a" background="white" borderthickness="8" groupname="selsex" foreground="#ffa3cd5a" fontweight="extrabold" fontfamily="fonts/me likey.ttf#me likey ~"/>
i have been trying made radio button green border , white center, seems going wrong button borderbrush property, since no matter color change it, doesnt appear.
this because in windows phone 7 default control template radiobutton not utilize borderbrush or borderthickness properties. you'll have create own controltemplate use implement through templatebinding.
for example, following controltemplate has border added inside binds appropriate properties.
<controltemplate targettype="radiobutton"> <grid background="transparent"> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal"/> <visualstate x:name="mouseover"/> <visualstate x:name="pressed"> <storyboard> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="enabledcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>collapsed</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="presseddarkcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="pressedlightcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="checkmark"> <discreteobjectkeyframe keytime="0" value="{staticresource phoneradiocheckboxcheckbrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="disabled"> <storyboard> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="enabledcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>collapsed</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="disableddarkcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="disabledlightcheckbackground"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="fill" storyboard.targetname="checkmark"> <discreteobjectkeyframe keytime="0" value="{staticresource phoneradiocheckboxcheckdisabledbrush}"/> </objectanimationusingkeyframes> <objectanimationusingkeyframes storyboard.targetproperty="foreground" storyboard.targetname="contentcontainer"> <discreteobjectkeyframe keytime="0" value="{staticresource phonedisabledbrush}"/> </objectanimationusingkeyframes> </storyboard> </visualstate> </visualstategroup> <visualstategroup x:name="checkstates"> <visualstate x:name="checked"> <storyboard> <objectanimationusingkeyframes storyboard.targetproperty="visibility" storyboard.targetname="checkmark"> <discreteobjectkeyframe keytime="0"> <discreteobjectkeyframe.value> <visibility>visible</visibility> </discreteobjectkeyframe.value> </discreteobjectkeyframe> </objectanimationusingkeyframes> </storyboard> </visualstate> <visualstate x:name="unchecked"/> <visualstate x:name="indeterminate"/> </visualstategroup> </visualstatemanager.visualstategroups> <!-- here templatebindings borderbrush , borderthickness --> <border borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}"> <grid margin="{staticresource phonetouchtargetlargeoverhang}"> <grid.columndefinitions> <columndefinition width="32"/> <columndefinition width="*"/> </grid.columndefinitions> <ellipse x:name="enabledcheckbackground" fill="{templatebinding background}" horizontalalignment="left" height="32" ishittestvisible="false" verticalalignment="center" width="32"/> <canvas horizontalalignment="left" height="32" ishittestvisible="false" opacity="{staticresource phonedarkthemeopacity}" verticalalignment="center" width="32"> <ellipse x:name="presseddarkcheckbackground" fill="{staticresource phoneradiocheckboxpressedbrush}" height="32" visibility="collapsed" width="32"/> <ellipse x:name="disableddarkcheckbackground" fill="{staticresource phoneradiocheckboxdisabledbrush}" height="32" visibility="collapsed" width="32"/> </canvas> <canvas horizontalalignment="left" height="32" ishittestvisible="false" opacity="{staticresource phonelightthemeopacity}" verticalalignment="center" width="32"> <ellipse x:name="pressedlightcheckbackground" fill="{staticresource phoneradiocheckboxpressedbrush}" height="32" stroke="{staticresource phoneforegroundbrush}" strokethickness="{staticresource phonestrokethickness}" visibility="collapsed" width="32"/> <ellipse x:name="disabledlightcheckbackground" fill="{staticresource phoneradiocheckboxdisabledbrush}" height="32" stroke="{staticresource phonedisabledbrush}" strokethickness="{staticresource phonestrokethickness}" visibility="collapsed" width="32"/> </canvas> <ellipse x:name="checkmark" fill="{staticresource phoneradiocheckboxcheckbrush}" horizontalalignment="center" height="16" ishittestvisible="false" visibility="collapsed" verticalalignment="center" width="16"/> <contentcontrol x:name="contentcontainer" contenttemplate="{templatebinding contenttemplate}" content="{templatebinding content}" grid.column="1" foreground="{templatebinding foreground}" fontsize="{templatebinding fontsize}" fontfamily="{templatebinding fontfamily}" horizontalcontentalignment="{templatebinding horizontalcontentalignment}" margin="12,0,0,0" padding="{templatebinding padding}" verticalcontentalignment="{templatebinding verticalcontentalignment}"/> </grid> </border> </grid> </controltemplate>
Comments
Post a Comment