开发者

Silverlight: Custom Radio button

开发者 https://www.devze.com 2023-03-13 11:12 出处:网络
I am trying to develop a custom radio button that looks like a two-option button control that looks somewhat as shown below with toggling of highlighted state. Not sure where to start开发者_如何学Go.

I am trying to develop a custom radio button that looks like a two-option button control that looks somewhat as shown below with toggling of highlighted state. Not sure where to start开发者_如何学Go.

Silverlight: Custom Radio button

Is there any such controls already available that I can use.


OK, here is a brief overview of what you will need to do ...

  1. Firstly, you will need to change the ControlTemplate for the existing RadioButton control. There are lots of tutorials available that describe this,, for example this one.
  2. Replace the standard template with some suitable markup for your illustration above. Perhaps a two column Grid?
  3. Within each Grid cell add a Rectangle, one behind Option1, and the other behind Option2
  4. Use the VisualStateManager to change the Fill property of each Rectangle based on the controls current VisualState. i.e. when Pressed toggle the background colours.

The steps above should help you achieve your goal. Please read the linked web pages and the Silverlight documentation. If you are still struggling after that,, come back and ask another question.

0

精彩评论

暂无评论...
验证码 换一张
取 消