方法A:
第一步:My自定义控件:Control
第二步:针对 “My自定义控件” 类型,编写《style》或《模板》(UI的外观完全由用户自己定义)
第三步: 使用My自定义控件时,引入style或模板(或者使用开发工具默认生成的主题字典自动渲染即可)
方法B:
第一步: My自定义控件:某个原生控件 { override 相关事件方法 }
第二步: 使用Blend修改某个原生控件的style或模板(另外,UI的外观也可以完全由用户自己定义,但这样做无意义,失去了初衷。。。)
第三步: 使用My自定义控件时,引入style或模板
如果使用TemplateBinding失败,则可以使用TemplatedParent进行处理