silverlight 中的自定义复选框
如何创建如下所示的自定义复选框。复选框是动态绘制的,并且可以具有自定义颜色。
How to create custom checkbox that looks like the one shown below. The checkboxes are dynamically drawn and can have custom colors.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,你可以只是设计它。从此处获取样式并更改它。样式中的关键组件是 VisualStateManager,确保您了解它的作用。
您还可以创建自定义控件,您可以阅读有关它的信息,例如 此处。
Well, you can just style it. Take the style from here and change it. The key component in the style is VisualStateManager, make sure you understand what it does.
Also you can create a custom control, you can read about it, for example, here.
我要做的是,创建一个名为 ImageCheckBox 的自定义控件,该控件继承自默认的 CheckBox 类,添加三个
ImageSource
类型的依赖属性,称为 CheckedImage、InminatedImage 和 UncheckedImage。只需根据控件的CheckStates
(即选中、未选中和不确定)切换其可见性
或不透明度
。What I would do is, create a custom control called ImageCheckBox which inherits from the default CheckBox class, add in three dependency properties of type
ImageSource
, called CheckedImage, IndeterminateImage and UncheckedImage. Just toggle theirVisibility
orOpacity
based on the control'sCheckStates
, i.e. Checked, Unchecked and Indeterminate.