How to change background color of checkbox when checkbox is IsChecked in XAML in windows phone 8.1

巧了我就是萌 提交于 2019-12-12 04:16:01

问题


Is there any way to change check box background color in xaml not c# . I know there are Checked and UnChecked event .but I have to use in Xaml . I have refer its template but can't find the solution . please help me for that

Thank you


回答1:


In the edit template style of the checkbox lookout for the x:Name="Checked" visualstate.

Add the following animation inside the storyboard to change the background of the checkbox when checked:

<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
                               Storyboard.TargetName="Grid">
      <DiscreteObjectKeyFrame KeyTime="0"
                              Value="#FFABCDEF" />  // argb value of your desired background color
</ObjectAnimationUsingKeyFrames> 


来源:https://stackoverflow.com/questions/35221472/how-to-change-background-color-of-checkbox-when-checkbox-is-ischecked-in-xaml-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!